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

From SmartBots Developers Docs
Jump to: navigation, search
 
Line 8: Line 8:
 
Related faster commands:
 
Related faster commands:
  
* [[../getLocation|Bot.getLocation()]] for a bot's location (region and/or coordinates).
+
* [[../getLocation|Bot.getLocation()]] for a bot's location (region and/or coordinates),
 
* [[../isOnline|Bot.isOnline()]] for bot online status.
 
* [[../isOnline|Bot.isOnline()]] for bot online status.
  
Line 34: Line 34:
 
''Bot.status()'' returns bot location ('location') just for compatibility reasons.
 
''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).
+
If you need real-time data we recommend using:
 +
 
 +
* [[../getLocation|Bot.getLocation()]] command to retrieve real-time bot location,
 +
* [[../isOnline|Bot.isOnline()]] command to retrieve real-time bot online status.  
 +
 
 +
''Bot.status()'' result may be cached (see notes above).
  
 
== Details ==
 
== Details ==

Latest revision as of 18:08, 4 June 2025

Returns the online status of the bot.

await Bot.status();

Related faster commands:

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.

If you need real-time data we recommend using:

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);