一定时间后取消提示或对话框-Bot Framework [英] Cancel a prompt or dialog after certain time - Bot Framework

查看:77
本文介绍了一定时间后取消提示或对话框-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.

这篇关于一定时间后取消提示或对话框-Bot Framework的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆