Bot Framework V4 Dialog wait for user input without prompting

白昼怎懂夜的黑 提交于 2019-12-11 15:49:51

问题


In Bot Framework V3 there was method Context.Wait() which provided a way how to wait for user input within dialog without necessarily prompting user for input. Typical scenario, is when you reply with HeroCard and you just wait for user's reaction, without sending pushy message like: "Please choose form the options".

In V4 I was not able to find to find context.Wait() respectively stepContext wait method, and so implementation of this behavior needed light walk around, provided in answer bellow. Maybe there is some better way ho to achieve it and will be glad if you share it.


回答1:


To achieve wait behavior without prompting user with the text, you can use send empty prompt like this:

 return await stepContext.PromptAsync("<emptyPrompt>", new PromptOptions { }, cancellationToken);



回答2:


you can return waiting result like this:

return new DialogTurnResult(DialogTurnStatus.Waiting);


来源:https://stackoverflow.com/questions/53334280/bot-framework-v4-dialog-wait-for-user-input-without-prompting

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