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

From SmartBots Developers Docs
Jump to: navigation, search
Line 21: Line 21:
  
 
{{API Variables Table End}}
 
{{API Variables Table End}}
 +
 +
== Important notes ==
 +
 +
The subsequent command calls may be cached up to 30 seconds.
  
 
== Details ==
 
== Details ==

Revision as of 14:45, 12 February 2025

Returns the online status of the bot.

const res = await Bot.status();
console.log("Status:", JSON.stringify(res, null, 2));

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

Important notes

The subsequent command calls may be cached up to 30 seconds.

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

Bot.status().then(function(res) {
	console.log("Status:", res);
});