Difference between revisions of "Bot Playground/Events/script dialog"

From SmartBots Developers Docs
Jump to: navigation, search
Line 23: Line 23:
 
Bot.on("script_dialog", function(event) {
 
Bot.on("script_dialog", function(event) {
 
console.log("Got a dialog:\n" +
 
console.log("Got a dialog:\n" +
event.text + "\n\n" +  
+
event.text + "\n\n" +  
"channel: " + event.channel + "\n" +
+
"channel: " + event.channel + "\n" +
"buttons:\n" + event.buttons.join("\n"));
+
"buttons:\n" + event.buttons.join("\n"));
 
});
 
});
 
</syntaxhighlight>
 
</syntaxhighlight>
  
 
{{NavMenu}}
 
{{NavMenu}}

Revision as of 19:01, 11 July 2016

Fires when bot receives a scripted dialog

Bot.on("script_dialog", 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 script_dialog
buttons Array The selection options (buttons) as array
channel integer The channel on which the dialog listen to.
owner_name The owner name from object that sent the dialog.
text The text in the dialog window
object_uuid The UUID of the object that sent the dialog.
object_name The name of the object that sent the dialog.

Example

Bot.on("script_dialog", function(event) {
	console.log("Got a dialog:\n" +
		event.text + "\n\n" + 
		"channel: " + event.channel + "\n" +
		"buttons:\n" + event.buttons.join("\n"));
});