How to use the botbuilder-dialogs-adaptive.BeginDialog function in botbuilder-dialogs-adaptive

To help you get started, we’ve selected a few botbuilder-dialogs-adaptive examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github microsoft / botbuilder-js / samples / 05. beginDialog / src / index.ts View on Github external
bot.rootDialog = dialogs;

//=================================================================================================
// Rules
//=================================================================================================

dialogs.recognizer = new RegExpRecognizer().addIntent('JokeIntent', /tell .*joke/i);

// Tell the user a joke
dialogs.addRule(new OnIntent('#JokeIntent', [], [
    new BeginDialog('TellJokeDialog')
]));

// Handle unknown intents
dialogs.addRule(new OnUnknownIntent([
    new BeginDialog('AskNameDialog')
]));


//=================================================================================================
// Child Dialogs
//=================================================================================================

const askNameDialog = new AdaptiveDialog('AskNameDialog', [
    new IfCondition('user.name == null', [
        new TextInput('user.name', `Hi! what's your name?`)
    ]),
    new SendActivity(`Hi {user.name}. It's nice to meet you.`),
    new EndDialog()
]);
dialogs.actions.push(askNameDialog);
github microsoft / botbuilder-js / samples / 05. beginDialog / lib / index.js View on Github external
server.post('/api/messages', (req, res) => {
    adapter.processActivity(req, res, async (context) => {
        // Route activity to bot.
        await bot.onTurn(context);
    });
});
// Initialize bots root dialog
const dialogs = new botbuilder_dialogs_adaptive_1.AdaptiveDialog();
bot.rootDialog = dialogs;
//=================================================================================================
// Rules
//=================================================================================================
dialogs.recognizer = new botbuilder_dialogs_adaptive_1.RegExpRecognizer().addIntent('JokeIntent', /tell .*joke/i);
// Tell the user a joke
dialogs.addRule(new botbuilder_dialogs_adaptive_1.OnIntent('#JokeIntent', [], [
    new botbuilder_dialogs_adaptive_1.BeginDialog('TellJokeDialog')
]));
// Handle unknown intents
dialogs.addRule(new botbuilder_dialogs_adaptive_1.OnUnknownIntent([
    new botbuilder_dialogs_adaptive_1.BeginDialog('AskNameDialog')
]));
//=================================================================================================
// Child Dialogs
//=================================================================================================
const askNameDialog = new botbuilder_dialogs_adaptive_1.AdaptiveDialog('AskNameDialog', [
    new botbuilder_dialogs_adaptive_1.IfCondition('user.name == null', [
        new botbuilder_dialogs_adaptive_1.TextInput('user.name', `Hi! what's your name?`)
    ]),
    new botbuilder_dialogs_adaptive_1.SendActivity(`Hi {user.name}. It's nice to meet you.`),
    new botbuilder_dialogs_adaptive_1.EndDialog()
]);
dialogs.actions.push(askNameDialog);
github microsoft / botbuilder-js / samples / 05. beginDialog / src / index.ts View on Github external
});
});

// Initialize bots root dialog
const dialogs = new AdaptiveDialog();
bot.rootDialog = dialogs;

//=================================================================================================
// Rules
//=================================================================================================

dialogs.recognizer = new RegExpRecognizer().addIntent('JokeIntent', /tell .*joke/i);

// Tell the user a joke
dialogs.addRule(new OnIntent('#JokeIntent', [], [
    new BeginDialog('TellJokeDialog')
]));

// Handle unknown intents
dialogs.addRule(new OnUnknownIntent([
    new BeginDialog('AskNameDialog')
]));


//=================================================================================================
// Child Dialogs
//=================================================================================================

const askNameDialog = new AdaptiveDialog('AskNameDialog', [
    new IfCondition('user.name == null', [
        new TextInput('user.name', `Hi! what's your name?`)
    ]),
github microsoft / botbuilder-js / samples / 05. beginDialog / lib / index.js View on Github external
});
});
// Initialize bots root dialog
const dialogs = new botbuilder_dialogs_adaptive_1.AdaptiveDialog();
bot.rootDialog = dialogs;
//=================================================================================================
// Rules
//=================================================================================================
dialogs.recognizer = new botbuilder_dialogs_adaptive_1.RegExpRecognizer().addIntent('JokeIntent', /tell .*joke/i);
// Tell the user a joke
dialogs.addRule(new botbuilder_dialogs_adaptive_1.OnIntent('#JokeIntent', [], [
    new botbuilder_dialogs_adaptive_1.BeginDialog('TellJokeDialog')
]));
// Handle unknown intents
dialogs.addRule(new botbuilder_dialogs_adaptive_1.OnUnknownIntent([
    new botbuilder_dialogs_adaptive_1.BeginDialog('AskNameDialog')
]));
//=================================================================================================
// Child Dialogs
//=================================================================================================
const askNameDialog = new botbuilder_dialogs_adaptive_1.AdaptiveDialog('AskNameDialog', [
    new botbuilder_dialogs_adaptive_1.IfCondition('user.name == null', [
        new botbuilder_dialogs_adaptive_1.TextInput('user.name', `Hi! what's your name?`)
    ]),
    new botbuilder_dialogs_adaptive_1.SendActivity(`Hi {user.name}. It's nice to meet you.`),
    new botbuilder_dialogs_adaptive_1.EndDialog()
]);
dialogs.actions.push(askNameDialog);
const tellJokeDialog = new botbuilder_dialogs_adaptive_1.AdaptiveDialog('TellJokeDialog', [
    new botbuilder_dialogs_adaptive_1.SendActivity(`Why did the 🐔 cross the 🛣️?`),
    new botbuilder_dialogs_adaptive_1.EndTurn(),
    new botbuilder_dialogs_adaptive_1.SendActivity(`To get to the other side...`),