How to use the botbuilder-dialogs-adaptive.ArrayChangeType 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 / lib / rootDialog / addToDo / index.js View on Github external
constructor() {
        super('AddToDo', [
            new botbuilder_dialogs_adaptive_1.LogStep(`AddToDo: entities = {turn.entities}`, true),
            new botbuilder_dialogs_adaptive_1.SaveEntity(schema_1.variables.title, schema_1.entities.title),
            new botbuilder_dialogs_adaptive_1.TextInput(schema_1.variables.title, `What would you like to call your new todo?`),
            new botbuilder_dialogs_adaptive_1.EditArray(botbuilder_dialogs_adaptive_1.ArrayChangeType.push, schema_1.user.todoList, schema_1.variables.title),
            new botbuilder_dialogs_adaptive_1.SendActivity(`Added a todo named "${schema_1.variables.print.title}". You can delete it by saying "delete todo named ${schema_1.variables.print.title}".`),
            new botbuilder_dialogs_adaptive_1.SendActivity(`To view your todos just ask me to "show my todos".`)
        ]);
        // Use parents recognizer
        this.recognizer = recognizer_1.getRecognizer();
        // Add interruption rules
        this.addRule(new botbuilder_dialogs_adaptive_1.IntentRule(schema_1.intents.Cancel, [
            new botbuilder_dialogs_adaptive_1.CancelDialog(schema_1.events.CancelAdd)
        ]));
    }
}
github microsoft / botbuilder-js / samples / 07. initProperty / lib / index.js View on Github external
bot.conversationState = new botbuilder_1.ConversationState(new botbuilder_1.MemoryStorage());
// Listen for incoming activities.
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;
// Handle unknown intents
dialogs.triggers.push(new botbuilder_dialogs_adaptive_1.OnUnknownIntent([
    new botbuilder_dialogs_adaptive_1.InitProperty('dialog.list', 'array'),
    new botbuilder_dialogs_adaptive_1.TextInput("dialog.item", "What is your name?"),
    new botbuilder_dialogs_adaptive_1.EditArray(botbuilder_dialogs_adaptive_1.ArrayChangeType.push, 'dialog.list', 'dialog.item'),
    new botbuilder_dialogs_adaptive_1.SendActivity('Your name in an array: {dialog.list}')
]));
//# sourceMappingURL=index.js.map
github microsoft / botbuilder-js / samples / 50. todo-bot / lib / rootDialog / clearToDos / index.js View on Github external
constructor() {
        super('ClearToDos', [
            new botbuilder_dialogs_adaptive_1.LogStep(`ClearToDos: todoList = {user.todoList}`),
            new botbuilder_dialogs_adaptive_1.IfCondition(`user.todoList != null`, [
                new botbuilder_dialogs_adaptive_1.EditArray(botbuilder_dialogs_adaptive_1.ArrayChangeType.clear, schema_1.user.todoList),
                new botbuilder_dialogs_adaptive_1.SendActivity(`All todos removed.`)
            ]).else([
                new botbuilder_dialogs_adaptive_1.SendActivity(`No todos to clear.`)
            ])
        ]);
        // Use parents recognizer
        this.recognizer = recognizer_1.getRecognizer();
    }
}
github microsoft / botbuilder-js / samples / 50. todo-bot / lib / addToDo / index.js View on Github external
constructor() {
        super('AddToDo', [
            new botbuilder_dialogs_adaptive_1.TextInput('$title', '@title', `What would you like to call your new todo?`),
            new botbuilder_dialogs_adaptive_1.EditArray(botbuilder_dialogs_adaptive_1.ArrayChangeType.push, 'user.todos', '$title'),
            new botbuilder_dialogs_adaptive_1.SendActivity(`Added a todo named "{$title}". You can delete it by saying "delete todo named {$title}".`),
            new botbuilder_dialogs_adaptive_1.IfCondition(`user.tips.showToDos != true`, [
                new botbuilder_dialogs_adaptive_1.SendActivity(`To view your todos just ask me to "show my todos".`),
                new botbuilder_dialogs_adaptive_1.SetProperty('user.tips.showToDos', 'true')
            ])
        ]);
        // Use parents recognizer
        this.recognizer = recognizer_1.getRecognizer();
        // Add interruption rules
        this.addRule(new botbuilder_dialogs_adaptive_1.OnIntent('#Cancel', [], [
            new botbuilder_dialogs_adaptive_1.CancelAllDialogs('cancelAdd')
        ]));
    }
}
github microsoft / botbuilder-js / samples / 50. todo-bot / lib / rootDialog / deleteToDo / index.js View on Github external
constructor() {
        super('DeleteToDo', [
            new botbuilder_dialogs_adaptive_1.LogStep(`DeleteToDo: todoList = {user.todoList}`),
            new botbuilder_dialogs_adaptive_1.IfCondition(`user.todoList != null`, [
                new botbuilder_dialogs_adaptive_1.SaveEntity(schema_1.variables.title, schema_1.entities.title),
                new botbuilder_dialogs_adaptive_1.ChoiceInput(schema_1.variables.title, `Which todo would you like to remove?`, schema_1.user.todoList),
                new botbuilder_dialogs_adaptive_1.EditArray(botbuilder_dialogs_adaptive_1.ArrayChangeType.remove, schema_1.user.todoList, schema_1.variables.title),
                new botbuilder_dialogs_adaptive_1.SendActivity(`Deleted the todo named "${schema_1.variables.print.title}". You can delete all your todos by saying "delete all todos".`)
            ]).else([
                new botbuilder_dialogs_adaptive_1.SendActivity(`No todos to delete.`)
            ])
        ]);
        // Use parents recognizer
        this.recognizer = recognizer_1.getRecognizer();
        // Add interruption rules
        this.addRule(new botbuilder_dialogs_adaptive_1.IntentRule(schema_1.intents.Cancel, [
            new botbuilder_dialogs_adaptive_1.CancelDialog(schema_1.events.CancelDelete)
        ]));
    }
}
github microsoft / botbuilder-js / samples / 50. todo-bot / lib / deleteToDo / index.js View on Github external
constructor() {
        super('DeleteToDo', [
            new botbuilder_dialogs_adaptive_1.LogAction(`DeleteToDo: todos = {user.todos}`),
            new botbuilder_dialogs_adaptive_1.IfCondition(`user.todos != null`, [
                new botbuilder_dialogs_adaptive_1.SetProperty('$title', '@title'),
                new botbuilder_dialogs_adaptive_1.ChoiceInput('$title', `Which todo would you like to remove?`, 'user.todos'),
                new botbuilder_dialogs_adaptive_1.EditArray(botbuilder_dialogs_adaptive_1.ArrayChangeType.remove, 'user.todos', '$title'),
                new botbuilder_dialogs_adaptive_1.SendActivity(`Deleted the todo named "{$title}".`),
                new botbuilder_dialogs_adaptive_1.IfCondition(`user.tips.clearToDos != true`, [
                    new botbuilder_dialogs_adaptive_1.SendActivity(`You can delete all your todos by saying "delete all todos".`),
                    new botbuilder_dialogs_adaptive_1.SetProperty('user.tips.clearToDos', 'true')
                ])
            ]).else([
                new botbuilder_dialogs_adaptive_1.SendActivity(`No todos to delete.`)
            ])
        ]);
        // Use parents recognizer
        this.recognizer = recognizer_1.getRecognizer();
        // Add interruption rules
        this.addRule(new botbuilder_dialogs_adaptive_1.OnIntent('#Cancel', [], [
            new botbuilder_dialogs_adaptive_1.CancelAllDialogs('cancelDelete')
        ]));
    }
github microsoft / botbuilder-js / samples / 50. todo-bot / lib / clearToDos / index.js View on Github external
constructor() {
        super('ClearToDos', [
            new botbuilder_dialogs_adaptive_1.LogAction(`ClearToDos: todos = {user.todos}`),
            new botbuilder_dialogs_adaptive_1.IfCondition(`user.todos != null`, [
                new botbuilder_dialogs_adaptive_1.EditArray(botbuilder_dialogs_adaptive_1.ArrayChangeType.clear, 'user.todos'),
                new botbuilder_dialogs_adaptive_1.SendActivity(`All todos removed.`)
            ]).else([
                new botbuilder_dialogs_adaptive_1.SendActivity(`No todos to clear.`)
            ])
        ]);
        // Use parents recognizer
        this.recognizer = recognizer_1.getRecognizer();
    }
}