Last active
May 11, 2020 15:44
-
-
Save saurav28/c71cb1f81b12ad508ee425bbdc920267 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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