Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const bot = new botbuilder_dialogs_1.DialogManager();
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.SetProperty('dialog.age', "'22'"),
new botbuilder_dialogs_adaptive_1.SwitchCondition('dialog.age', null, [
new case_1.Case("21", [
new botbuilder_dialogs_adaptive_1.SendActivity("age is 21!")
]),
new case_1.Case("22", [
new botbuilder_dialogs_adaptive_1.SendActivity("age is 22!")
])
])
]));
//# sourceMappingURL=index.js.map
// 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 AdaptiveDialog();
bot.rootDialog = dialogs;
// Handle unknown intents
dialogs.triggers.push(new OnUnknownIntent([
new SetProperty('dialog.age', "'22'"),
new SwitchCondition('dialog.age', null, [
new Case("21", [
new SendActivity("age is 21!")
]),
new Case("22", [
new SendActivity("age is 22!")
])
])
]));
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;
}