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

From SmartBots Developers Docs
Jump to: navigation, search
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
 
{{DISPLAYTITLE:{{SUBPAGENAME}}}}
 
{{DISPLAYTITLE:{{SUBPAGENAME}}}}
<onlyinclude>Returns if the avatar is a bot on Smartbots.</onlyinclude>
+
<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 at Smartbots
+
{{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 = await Bot.checkScriptedAgent("Glaznah Gassner");
+
Bot.on("chat_message", async function (event) {
console.log(`Glaznah Gassner is a Bot: ${isBot}`);
+
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`);
	}
}