Difference between revisions of "Bot Playground/Commands/status"
From SmartBots Developers Docs
Line 3: | Line 3: | ||
<syntaxhighlight lang="javascript"> | <syntaxhighlight lang="javascript"> | ||
− | + | await Bot.status(); | |
− | + | ||
</syntaxhighlight> | </syntaxhighlight> | ||
+ | |||
+ | Check [[../getLocation|Bot.getLocation()]] command if you are looking for bot region/position. | ||
{{API Command Table}} | {{API Command Table}} | ||
Line 18: | 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}} | ||
Line 24: | Line 25: | ||
== Important notes == | == Important notes == | ||
− | The subsequent | + | 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 39: | Line 46: | ||
<syntaxhighlight lang="javascript"> | <syntaxhighlight lang="javascript"> | ||
− | Bot.status() | + | const status = await Bot.status() |
− | + | console.log("My status is:", res); | |
− | + | ||
</syntaxhighlight> | </syntaxhighlight> | ||
{{NavMenu}} | {{NavMenu}} | ||
__NOTOC__ | __NOTOC__ |
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 region/position.
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);