Difference between revisions of "Bot Playground/Events/chat message"

From SmartBots Developers Docs
Jump to: navigation, search
(Created page with "{{DISPLAYTITLE:chat_message}} <onlyinclude>Fires when bot receives a message in the local chat</onlyinclude> {{API Event Table}} {{API Variable Group|Output}} {{API Variable|...")
 
Line 4: Line 4:
 
{{API Event Table}}
 
{{API Event Table}}
 
{{API Variable Group|Output}}
 
{{API Variable Group|Output}}
 +
{{API Variable|name}}The name of the event in this case chat_message
 +
{{API Variable|speaker_type}}The sender of the message. Can be AVATAR or OBJECT
 +
{{API Variable|speaker_name}}The name of the sender
 +
{{API Variable|speaker_uuid}}The UUID of the sender
 +
{{API Variable|speaker_owner}}The UUID of the owner from the sender. Can be different from speaker_uuid if speaker_type is an object.
 
{{API Variable|message}}The text of the message
 
{{API Variable|message}}The text of the message
  

Revision as of 02:37, 1 July 2016

Fires when bot receives a message in the local chat

Reference

This event comes with the following event object:

Variable Required Description
Output:
name The name of the event in this case chat_message
speaker_type The sender of the message. Can be AVATAR or OBJECT
speaker_name The name of the sender
speaker_uuid The UUID of the sender
speaker_owner The UUID of the owner from the sender. Can be different from speaker_uuid if speaker_type is an object.
message The text of the message

Example

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

console.log("Bot is listening, local chat");