How to use the botbuilder-dialogs-adaptive.OnDialogEvent 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 / 50. todo-bot / src / rootDialog / index.ts View on Github external
this.addRule(new OnIntent('#ShowToDos', [], [
            new ShowToDos()
        ]));

        this.addRule(new OnUnknownIntent([
            new IfCondition(`user.greeted != true`, [
                new SendActivity(`Hi! I'm a ToDo bot. Say "add a todo named first one" to get started.`),
                new SetProperty(`user.greeted`, `true`)
            ]).else([
                new SendActivity(`Say "add a todo named first one" to get started.`)
            ])
        ]));

        // Define rules to handle cancel events
        this.addRule(new OnDialogEvent('cancelAdd', [
            new SendActivity(`Ok... Cancelled adding new todo.`)
        ]));

        this.addRule(new OnDialogEvent('cancelDelete', [
            new SendActivity(`Ok...`)
        ]));

        // Define rules for handling errors
        this.addRule(new OnDialogEvent('error', [
            new SendActivity(`Oops. An error occurred: {message}`)
        ]));
    }
}
github microsoft / botbuilder-js / samples / 50. todo-bot / src / rootDialog / index.ts View on Github external
this.addRule(new OnUnknownIntent([
            new IfCondition(`user.greeted != true`, [
                new SendActivity(`Hi! I'm a ToDo bot. Say "add a todo named first one" to get started.`),
                new SetProperty(`user.greeted`, `true`)
            ]).else([
                new SendActivity(`Say "add a todo named first one" to get started.`)
            ])
        ]));

        // Define rules to handle cancel events
        this.addRule(new OnDialogEvent('cancelAdd', [
            new SendActivity(`Ok... Cancelled adding new todo.`)
        ]));

        this.addRule(new OnDialogEvent('cancelDelete', [
            new SendActivity(`Ok...`)
        ]));

        // Define rules for handling errors
        this.addRule(new OnDialogEvent('error', [
            new SendActivity(`Oops. An error occurred: {message}`)
        ]));
    }
}
github microsoft / botbuilder-js / samples / 50. todo-bot / lib / rootDialog / index.js View on Github external
new botbuilder_dialogs_adaptive_1.IfCondition(`user.greeted != true`, [
                new botbuilder_dialogs_adaptive_1.SendActivity(`Hi! I'm a ToDo bot. Say "add a todo named first one" to get started.`),
                new botbuilder_dialogs_adaptive_1.SetProperty(`user.greeted`, `true`)
            ]).else([
                new botbuilder_dialogs_adaptive_1.SendActivity(`Say "add a todo named first one" to get started.`)
            ])
        ]));
        // Define rules to handle cancel events
        this.triggers.push(new botbuilder_dialogs_adaptive_1.OnDialogEvent('cancelAdd', [
            new botbuilder_dialogs_adaptive_1.SendActivity(`Ok... Cancelled adding new todo.`)
        ]));
        this.triggers.push(new botbuilder_dialogs_adaptive_1.OnDialogEvent('cancelDelete', [
            new botbuilder_dialogs_adaptive_1.SendActivity(`Ok...`)
        ]));
        // Define rules for handling errors
        this.triggers.push(new botbuilder_dialogs_adaptive_1.OnDialogEvent('error', [
            new botbuilder_dialogs_adaptive_1.SendActivity(`Oops. An error occurred: {message}`)
        ]));
    }
}
github microsoft / botbuilder-js / samples / 50. todo-bot / src / rootDialog / index.ts View on Github external
]).else([
                new SendActivity(`Say "add a todo named first one" to get started.`)
            ])
        ]));

        // Define rules to handle cancel events
        this.addRule(new OnDialogEvent('cancelAdd', [
            new SendActivity(`Ok... Cancelled adding new todo.`)
        ]));

        this.addRule(new OnDialogEvent('cancelDelete', [
            new SendActivity(`Ok...`)
        ]));

        // Define rules for handling errors
        this.addRule(new OnDialogEvent('error', [
            new SendActivity(`Oops. An error occurred: {message}`)
        ]));
    }
}
github microsoft / botbuilder-js / samples / 50. todo-bot / lib / rootDialog / index.js View on Github external
this.triggers.push(new botbuilder_dialogs_adaptive_1.OnIntent('#ShowToDos', [], [
            new showToDos_1.ShowToDos()
        ]));
        this.triggers.push(new botbuilder_dialogs_adaptive_1.OnUnknownIntent([
            new botbuilder_dialogs_adaptive_1.IfCondition(`user.greeted != true`, [
                new botbuilder_dialogs_adaptive_1.SendActivity(`Hi! I'm a ToDo bot. Say "add a todo named first one" to get started.`),
                new botbuilder_dialogs_adaptive_1.SetProperty(`user.greeted`, `true`)
            ]).else([
                new botbuilder_dialogs_adaptive_1.SendActivity(`Say "add a todo named first one" to get started.`)
            ])
        ]));
        // Define rules to handle cancel events
        this.triggers.push(new botbuilder_dialogs_adaptive_1.OnDialogEvent('cancelAdd', [
            new botbuilder_dialogs_adaptive_1.SendActivity(`Ok... Cancelled adding new todo.`)
        ]));
        this.triggers.push(new botbuilder_dialogs_adaptive_1.OnDialogEvent('cancelDelete', [
            new botbuilder_dialogs_adaptive_1.SendActivity(`Ok...`)
        ]));
        // Define rules for handling errors
        this.triggers.push(new botbuilder_dialogs_adaptive_1.OnDialogEvent('error', [
            new botbuilder_dialogs_adaptive_1.SendActivity(`Oops. An error occurred: {message}`)
        ]));
    }
}
github microsoft / botbuilder-js / samples / 50. todo-bot / lib / rootDialog / index.js View on Github external
this.triggers.push(new botbuilder_dialogs_adaptive_1.OnIntent('#ClearToDos', [], [
            new clearToDos_1.ClearToDos()
        ]));
        this.triggers.push(new botbuilder_dialogs_adaptive_1.OnIntent('#ShowToDos', [], [
            new showToDos_1.ShowToDos()
        ]));
        this.triggers.push(new botbuilder_dialogs_adaptive_1.OnUnknownIntent([
            new botbuilder_dialogs_adaptive_1.IfCondition(`user.greeted != true`, [
                new botbuilder_dialogs_adaptive_1.SendActivity(`Hi! I'm a ToDo bot. Say "add a todo named first one" to get started.`),
                new botbuilder_dialogs_adaptive_1.SetProperty(`user.greeted`, `true`)
            ]).else([
                new botbuilder_dialogs_adaptive_1.SendActivity(`Say "add a todo named first one" to get started.`)
            ])
        ]));
        // Define rules to handle cancel events
        this.triggers.push(new botbuilder_dialogs_adaptive_1.OnDialogEvent('cancelAdd', [
            new botbuilder_dialogs_adaptive_1.SendActivity(`Ok... Cancelled adding new todo.`)
        ]));
        this.triggers.push(new botbuilder_dialogs_adaptive_1.OnDialogEvent('cancelDelete', [
            new botbuilder_dialogs_adaptive_1.SendActivity(`Ok...`)
        ]));
        // Define rules for handling errors
        this.triggers.push(new botbuilder_dialogs_adaptive_1.OnDialogEvent('error', [
            new botbuilder_dialogs_adaptive_1.SendActivity(`Oops. An error occurred: {message}`)
        ]));
    }
}