chat_message

From SmartBots Developers Docs
Bot PlaygroundEvents
Revision as of 18:45, 10 September 2022 by Gg (Talk | contribs)

Jump to: navigation, search

Fires when bot receives a message in the local chat

Bot.on("chat_message", 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 chat_message
speaker_type The sender of the message. Can be AGENT or OBJECT
speaker_name The name of the sender
speaker_uuid The UUID of the sender
speaker_owner The UUID of the owner of the sender object.
message The text of the message
chat_type One of the following: Normal, Whisper, Shout, OwnerSay

Example

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

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