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

编程入门 行业动态 更新时间:2024-10-26 12:34:16
本文介绍了一定时间后取消提示或对话框-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 token或HandleSystemMessageAsync 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.

更多推荐

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

本文发布于:2023-11-17 06:28:22,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1609155.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:对话框   提示   时间

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!