Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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();
}
}
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();
constructor() {
super('ShowToDos', [
new botbuilder_dialogs_adaptive_1.LogAction(`ShowToDos: todos = {user.todos}`, true),
new botbuilder_dialogs_adaptive_1.IfCondition(`user.todos != null`, [
new botbuilder_dialogs_adaptive_1.SendList(`user.todos`, `Here are your todos:`)
]).else([
new botbuilder_dialogs_adaptive_1.SendActivity(`You have no todos.`)
])
]);
// Use parents recognizer
this.recognizer = recognizer_1.getRecognizer();
}
}
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
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();
}
}
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();
}
}