Difference between revisions of "Bot Playground/Events/group im"

From SmartBots Developers Docs
Jump to: navigation, search
(Created page with "{{DISPLAYTITLE:group_im}} <onlyinclude>Fires when bot receives a group chat message.</onlyinclude> <syntaxhighlight lang="javascript"> Bot.on("group_im", function(event) { .....")
 
 
Line 24: Line 24:
 
});
 
});
  
console.log("Bot is listening, to group chat.");
+
console.log("Bot is listening to group chat.");
 
</syntaxhighlight>
 
</syntaxhighlight>
  
 
{{NavMenu}}
 
{{NavMenu}}

Latest revision as of 13:01, 11 October 2022

Fires when bot receives a group chat message.

Bot.on("group_im", function(event) { ... });

Reference

This event comes with the following event object:

Variable Required Description
event object properties:
name The name of the event in this case group_im
group_name The same of the group
group_uuid The UUUID of the group
speaker_name The name of the sender
speaker_uuid The UUID of the sender
message The text of the message

Example

Bot.on("group_im", function(event) {
  console.log(event.group_name + ": " + event.speaker_name +" says: \n" + event.message);
});

console.log("Bot is listening to group chat.");