Difference between revisions of "Bot Playground/Commands/checkScriptedAgent"
From SmartBots Developers Docs
(Created page with "{{DISPLAYTITLE:{{SUBPAGENAME}}}} <onlyinclude>Returns if the avatar is a bot on Smartbots.</onlyinclude> <syntaxhighlight lang="javascript"> const res = await Bot.checkScript...") |
|||
| (2 intermediate revisions by the same user not shown) | |||
| 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}} | ||
| Line 22: | Line 22: | ||
<syntaxhighlight lang="javascript"> | <syntaxhighlight lang="javascript"> | ||
| − | let isBot = Bot.checkScriptedAgent( | + | Bot.on("chat_message", async function (event) { |
| − | console.log(` | + | let isBot = await Bot.checkScriptedAgent(event.speaker_name); |
| + | if(isBot) { | ||
| + | console.log(`Message from Bot`); | ||
| + | } | ||
| + | } | ||
</syntaxhighlight> | </syntaxhighlight> | ||
{{NavMenu}} | {{NavMenu}} | ||
__NOTOC__ | __NOTOC__ | ||
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`);
}
}