botframework-sdk icon indicating copy to clipboard operation
botframework-sdk copied to clipboard

Intent and dialog handler Node.JS

Open VishalWaman opened this issue 10 years ago • 2 comments

I have case where we need common code to handle intent = help and dialog= help.

Now I need to write separate code for dialog and intent

bot.dialog('menu', [ function (session) {....

intents.matches('menu', [ function (session) {

Is there any way that manages both at common function ?

VishalWaman avatar Aug 09 '16 09:08 VishalWaman

The easiest solution is probably to just invoke the menu dialog from your intent handler:

var intents = new builder.IntentDialog();
bot.dialog('/', intents);
intents.matches(menu, function(session) {
    session.beginDialog('menu');
});

bot.dialog('menu', [
    function (session, args, next) {
        ....
    },
    ....
]);

Does that work?

jorenl avatar Aug 12 '16 19:08 jorenl

Yes it works for me...

VishalWaman avatar Aug 13 '16 02:08 VishalWaman