node.js - Microsoft Bot 框架 session.endDialog() 使用
问题描述
如果您替换对话框,然后之前的对话框存储在堆栈中并存储在某处,我会在人们发布的某个地方阅读 Bot 文档。
现在我尝试按照 endDialog() 然后 replaceDialog();
callRequest.GetWebAPICall(session, urlData, function (body) {
if(body.statusCode == 200) {
if(body.data == undefined) {
builder.Prompts.choice(session,Want to Select List?", "Yes|No",{listStyle: builder.ListStyle.button});
} else {
session.endDialog();
session.replaceDialog('/Show List');
}
} else {
session.send('Something went wrong. You can use the back or top command.');
session.replaceDialog('/menu');
}
});
需要知道我是否替换以下行
session.endDialog();
session.replaceDialog('/Show List');
经过
session.endDialog('/Show List');
解决方案
不endDialog()
,没有启动新对话框的功能。可以参考函数定义界面endDialog(message?: TextOrMessageType, ...args: any\[\]): Session;
。
在您的情况下,'/Show List'
将作为消息发送给用户。
并且还有一个关于 的误解replaceDialog()
。
结束当前对话框并开始一个新的对话框。在新对话框完成之前,不会恢复父对话框。
如果需要存储之前的对话框,可以使用beginDialog()
推荐阅读
- javascript - 所有 react-run 命令都不起作用。| UnhandledPromiseRejectionWarning:DiscordAPIError:无法发送空消息
- php - 使用变量定位子数组并将其移动到主数组的顶部
- microsoft-teams - 更改 Microsoft 团队中已发布应用的 appName 和徽标
- windows - 分析 Windows 内存转储文件 - nt!TRIAGE_9F_POWER
- html - ReactJS如何限制内联输入值?
- python - 从数据框中的列中获取第一个和最后一个值
- c++ - 是否可以在不调用 std 异步的情况下使用阻塞析构函数创建 std 未来?
- javascript - 如何为类中定义的依赖项设置 Sinon 间谍,而不是 Sinon 存根?
- ios - 填充 UICollectionViewCell 的高度
- asp.net-core - 如何在 ASP.NET Core 中检索控制器类型?