How to use the botbuilder-dialogs-adaptive.OnBeginDialog 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-Samples / experimental / adaptive-dialog / javascript_nodejs / 05.multi-turn-prompt / dialogs / userProfileDialog.js View on Github external
constructor() {
        super('userProfileDialog');
        let lgFile = Templates.parseFile(path.join(__dirname, "userProfileDialog.lg"));
        let userProfileAdaptiveDialog = new AdaptiveDialog(ROOT_DIALOG).configure({
            generator: new TemplateEngineLanguageGenerator(lgFile),
            triggers: [
                new OnBeginDialog([
                    // Ask for user's age and set it in user.userProfile scope.
                    new TextInput().configure(
                    {
                        // Set the output of the text input to this property in memory.
                        property: new StringExpression("user.userProfile.Transport"),
                        prompt: new ActivityTemplate("${ModeOfTransportPrompt.Text()}")
                    }),
                    new TextInput().configure(
                    {
                        property: new StringExpression("user.userProfile.Name"),
                        prompt: new ActivityTemplate("${AskForName()}")
                    }),
                    // SendActivity supports full language generation resolution.
                    // See here to learn more about language generation
                    // https://aka.ms/language-generation
                    new SendActivity("${AckName()}"),
github microsoft / botbuilder-js / samples / 50. todo-bot / src / showToDos / index.ts View on Github external
constructor() {
        super('ShowToDos');

        this.triggers.push(new OnBeginDialog([
            new LogAction(`ShowToDos: todos = {user.todos}`, true),
            new IfCondition(`user.todos != null`, [
                new SendList(`user.todos`, `Here are your todos:`)
            ]).else([
                new SendActivity(`You have no todos.`)
            ])
        ]));

        // Use parents recognizer
        this.recognizer = getRecognizer();
    }
}
github microsoft / BotBuilder-Samples / experimental / adaptive-dialog / javascript_nodejs / declarative / 60.adaptive-bot / index.js View on Github external
function createChoiceInputForAllAdaptiveDialogs() {
    const rootDialog = new AdaptiveDialog(AdaptiveDialog.name);
    const choices = [];
    const switchCases = [];
    (resourceExplorer.getResources('.dialog') || []).forEach(resource => {
        if (resource.resourceId !== undefined && resource.resourceId.endsWith('.main.dialog')) {
            let dialogName = path.basename(resource.resourceId, '.main.dialog');
            const subDialog = resourceExplorer.loadType(resource);
            choices.push({value : dialogName});
            switchCases.push(new Case(dialogName, [subDialog]));
        }
    });
    rootDialog.generator = new TemplateEngineLanguageGenerator();
    rootDialog.triggers.push(new OnBeginDialog([
        new ChoiceInput().configure({
            property: new StringExpression('turn.userChoice'),
            prompt: new ActivityTemplate(`Choose a declarative sample to run..`),
            style: new EnumExpression(ListStyle.list),
            choices: new ArrayExpression(choices),
            alwaysPrompt: new BoolExpression(true)
        }),
        new SendActivity("# Running ${turn.userChoice}.main.dialog"),
        new SwitchCondition('turn.userChoice', switchCases),
        new RepeatDialog()
    ]));
    return rootDialog;
}