How to use the botbuilder-dialogs-adaptive.EditArray 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 / 07. initProperty / src / index.ts 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 AdaptiveDialog();
bot.rootDialog = dialogs;

// Handle unknown intents
dialogs.addRule(new OnUnknownIntent([
    new InitProperty('dialog.list', 'array'),
    new TextInput("dialog.item", "What is your name?"),
    new EditArray(ArrayChangeType.push, 'dialog.list', 'dialog.item'),
    new SendActivity('Your name in an array: {dialog.list}')
]));
github microsoft / botbuilder-js / samples / 50. todo-bot / src / addToDo / index.ts View on Github external
constructor() {
        super('AddToDo', [
            new TextInput('$title', '@title', `What would you like to call your new todo?`),
            new EditArray(ArrayChangeType.push, 'user.todos', '$title'),
            new SendActivity(`Added a todo named "{$title}". You can delete it by saying "delete todo named {$title}".`),
            new IfCondition(`user.tips.showToDos != true`, [
                new SendActivity(`To view your todos just ask me to "show my todos".`),
                new SetProperty('user.tips.showToDos', 'true')
            ])
        ]);

        // Use parents recognizer
        this.recognizer = getRecognizer();

        // Add interruption rules
        this.addRule(new OnIntent('#Cancel', [], [
            new CancelAllDialogs('cancelAdd')
        ]));
    }
}
github microsoft / botbuilder-js / samples / 50. todo-bot / src / clearToDos / index.ts View on Github external
constructor() {
        super('ClearToDos', [
            new LogAction(`ClearToDos: todos = {user.todos}`),
            new IfCondition(`user.todos != null`, [
                new EditArray(ArrayChangeType.clear, 'user.todos'),
                new SendActivity(`All todos removed.`)
            ]).else([
                new SendActivity(`No todos to clear.`)
            ])
        ]);

        // Use parents recognizer
        this.recognizer = getRecognizer();
    }
}
github microsoft / botbuilder-js / samples / 50. todo-bot / src / deleteToDo / index.ts View on Github external
constructor() {
        super('DeleteToDo', [
            new LogAction(`DeleteToDo: todos = {user.todos}`),
            new IfCondition(`user.todos != null`, [
                new SetProperty('$title', '@title'),
                new ChoiceInput('$title', `Which todo would you like to remove?`, 'user.todos'),
                new EditArray(ArrayChangeType.remove, 'user.todos', '$title'),
                new SendActivity(`Deleted the todo named "{$title}".`),
                new IfCondition(`user.tips.clearToDos != true`, [
                    new SendActivity(`You can delete all your todos by saying "delete all todos".`),
                    new SetProperty('user.tips.clearToDos', 'true')
                ])
            ]).else([
                new SendActivity(`No todos to delete.`)
            ])
        ]);

        // Use parents recognizer
        this.recognizer = getRecognizer();

        // Add interruption rules
        this.addRule(new OnIntent('#Cancel', [], [
            new CancelAllDialogs('cancelDelete')