Difference between revisions of "Bot Playground/Commands/checkScriptedAgent"
From SmartBots Developers Docs
Line 1: | Line 1: | ||
{{DISPLAYTITLE:{{SUBPAGENAME}}}} | {{DISPLAYTITLE:{{SUBPAGENAME}}}} | ||
− | <onlyinclude>Returns if the | + | <onlyinclude>Returns if the resident is scripted agents known by SmartBots. It included all SmartBots bots, and other residents our system considers bot or scripted agent.</onlyinclude> |
<syntaxhighlight lang="javascript"> | <syntaxhighlight lang="javascript"> | ||
Line 14: | Line 14: | ||
{{API Variable Group|Output}} | {{API Variable Group|Output}} | ||
− | {{API Variable|return value|boolean}} true if resident is the bot | + | {{API Variable|return value|boolean}} true if resident is the bot |
{{API Variables Table End}} | {{API Variables Table End}} |
Latest revision as of 17:09, 17 February 2025
Returns if the resident is scripted agents known by SmartBots. It included all SmartBots bots, and other residents our system considers bot or scripted agent.
const res = await Bot.checkScriptedAgent("slnameOrUUID");
console.log("Is Bot Scripted Agent:", res);
Reference
This command accepts the following parameters:
Variable | Required | Description
| |
---|---|---|---|
Input: | |||
slName or UUID | yes | The Avatar SL Name or UUID | |
Output: | |||
return value | boolean | true if resident is the bot |
Examples
Bot.on("chat_message", async function (event) {
let isBot = await Bot.checkScriptedAgent(event.speaker_name);
if(isBot) {
console.log(`Message from Bot`);
}
}