全域呼叫終斷原本的dialog流程,這個部份去年coding的時候,還沒有。
// The dialog stack is cleared and this dialog is invoked when the user enters 'help'.
bot.dialog('help', function (session, args, next) {
session.endDialog("This is a bot that can help you make a dinner reservation. <br/>Please say 'next' to continue");
})
.triggerAction({
matches: /^help$/i,
});
bot.dialog('help', function (session, args, next) {
session.endDialog("This is a bot that can help you make a dinner reservation. <br/>Please say 'next' to continue");
})
.triggerAction({
matches: /^help$/i,
onSelectAction: (session, args, next) => {
// Add the help dialog to the dialog stack
// (override the default behavior of replacing the stack)
session.beginDialog(args.action, args);
}
});
這兩個範例都可以全域呼叫,
差別在於 onSelectAction 不會終止原本的dialog流程,結束之後,還是會回到原本的dialog.