一定时间后取消提示或对话框-Bot Framework

问题描述:

如果在一定时间内没有用户输入,我有一个关于取消提示或对话框的问题. 我需要一种在提示中以某种方式超时的方法.

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.

示例:
Bot提示用户:您几岁?".
Bot现在正在等待用户的响应,但是用户从不响应,并且Bot仍在等待.

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.

就我而言,该漫游器仅应等待20秒,然后关闭对话框. cancellation tokenHandleSystemMessageAsync Method中的超时实现对于此目的是否有帮助,我将如何在提示时实现呢?
谢谢您的任何想法!

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!

您可以将时间戳记保存在context.UserData中,然后在收到新消息时检查时间差是否大于20秒并路由对话框适当地.

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.