Skip to content

Instantly share code, notes, and snippets.

@saurav28
Last active May 11, 2020 15:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save saurav28/c71cb1f81b12ad508ee425bbdc920267 to your computer and use it in GitHub Desktop.
Save saurav28/c71cb1f81b12ad508ee425bbdc920267 to your computer and use it in GitHub Desktop.
let myDialog = new BotkitConversation(DIALOG_ID, controller);
try {
myDialog.say('Hello');
myDialog.ask('Do you like Music?', [
{
pattern: 'yes',
handler: async function (response, convo, bot) {
await askMusicPreferences(response, convo, bot);
}
},
{
pattern: 'no',
handler: async function (response, convo, bot) {
await convo.gotoThread('hates_life');
}
}
], { key: 'response' });
//add a dialog to the controller
controller.addDialog(myDialog);
} catch (err) {
console.log('error occurred', err);
}
controller.hears('hi', 'message', async (bot, message) => {
console.log('I heard a message');
await bot.beginDialog(DIALOG_ID);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment