Difference between revisions of "Bot Playground/Commands/status"

From SmartBots Developers Docs
Jump to: navigation, search
(Created page with "{{DISPLAYTITLE:{{SUBPAGENAME}}}} <onlyinclude>Returns the online status of the bot.</onlyinclude> <syntaxhighlight lang="javascript"> Bot.status().then(function(res) { conso...")
 
 
(3 intermediate revisions by the same user not shown)
Line 3: Line 3:
  
 
<syntaxhighlight lang="javascript">
 
<syntaxhighlight lang="javascript">
Bot.status().then(function(res) {
+
await Bot.status();
console.log("Status:", res);
+
});
+
 
</syntaxhighlight>
 
</syntaxhighlight>
 +
 +
Check [[../getLocation|Bot.getLocation()]] command if you are looking for bot location (region and/or coordinates).
  
 
{{API Command Table}}
 
{{API Command Table}}
Line 19: Line 19:
 
{{API Variable|slname|}} Full SL name of the bot
 
{{API Variable|slname|}} Full SL name of the bot
 
{{API Variable|uuid|}} Bot avatar UUID
 
{{API Variable|uuid|}} Bot avatar UUID
{{API Variable|location|}} Current bot location if bot is online ("Region/X/Y/Z")
+
{{API Variable|location|}} Current bot location if bot is online ("Region/X/Y/Z") - legacy see "Bot location" below
  
 
{{API Variables Table End}}
 
{{API Variables Table End}}
 +
 +
== Important notes ==
 +
 +
The subsequent 'status' calls may be cached up to 30 seconds.
 +
 +
== Bot location ==
 +
 +
''Bot.status()'' returns bot location ('location') just for compatibility reasons.
 +
 +
We recommend using [[../getLocation|Bot.getLocation()]] command to retrieve real-time bot location. ''Bot.status()'' result may be cached (see notes above).
  
 
== Details ==
 
== Details ==
Line 36: Line 46:
  
 
<syntaxhighlight lang="javascript">
 
<syntaxhighlight lang="javascript">
Bot.status().then(function(res) {
+
const status = await Bot.status()
console.log("Status:", res);
+
console.log("My status is:", res);
});
+
 
</syntaxhighlight>
 
</syntaxhighlight>
  
 
{{NavMenu}}
 
{{NavMenu}}
 
__NOTOC__
 
__NOTOC__

Latest revision as of 09:45, 27 February 2025

Returns the online status of the bot.

await Bot.status();

Check Bot.getLocation() command if you are looking for bot location (region and/or coordinates).

Reference

This command accepts the following parameters:

Variable Required Description


Input:
Output:
Function returns a Promise with the following data:
success bool true if command completed successfully
error string error string if command has failed
status Current online status of the bot (see "Details")
online "1" if bot is online, "0" otherwise
slname Full SL name of the bot
uuid Bot avatar UUID
location Current bot location if bot is online ("Region/X/Y/Z") - legacy see "Bot location" below

Important notes

The subsequent 'status' calls may be cached up to 30 seconds.

Bot location

Bot.status() returns bot location ('location') just for compatibility reasons.

We recommend using Bot.getLocation() command to retrieve real-time bot location. Bot.status() result may be cached (see notes above).

Details

The following statuses can be returned:

  • ONLINE - the bot is online
  • PRE-CONNECTING - the bot is going to log in and waits for a SL login server response
  • CONNECTING - SL login server logs the bot in
  • LOGGED OUT - bot is logged out now (gracefully, by the owner's command)
  • OFFLINE - bot can not be contacted. This is an unexpected behavior and usually happens while SmartBots servers are restarting

Examples

const status = await Bot.status()
console.log("My status is:", res);