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...")
 
 
Line 3: Line 3:
  
 
<syntaxhighlight lang="javascript">
 
<syntaxhighlight lang="javascript">
Bot.status().then(function(res) {
+
const res = await Bot.status();
console.log("Status:", res);
+
console.log("Status:", JSON.stringify(res, null, 2));
});
+
 
</syntaxhighlight>
 
</syntaxhighlight>
  

Latest revision as of 13:56, 18 October 2022

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

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