Cancel a prompt or dialog after certain time - Bot Framework

心不动则不痛 提交于 2019-12-22 07:46:14

问题


I have a question about cancelling a prompt or a dialog if there is no input from the user within a certain period of time. I need a way to somehow have a time out within prompts.

Example:
Bot prompts the user: "How old are you?".
The Bot now awaits a response from the user, but the user never response and the bot is still waiting.

In my case the bot should only wait 20 seconds and then close the dialog. Is the cancellation token or a timeout implementation in the HandleSystemMessageAsync Method any helpful for that purpose and how would I implement that for a prompt?
Thank you for any ideas!


回答1:


You could save a timestamp in the context.UserData, and then when you receive a new message check if the difference in time is >20 seconds and route the dialog appropriately.



来源:https://stackoverflow.com/questions/41825964/cancel-a-prompt-or-dialog-after-certain-time-bot-framework

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!