问题
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