【问题标题】:Bot Framework V4 Dialog wait for user input without promptingBot Framework V4 Dialog 等待用户输入而不提示
【发布时间】:2018-11-16 08:46:45
【问题描述】:
在 Bot Framework V3 中有一个方法 Context.Wait(),它提供了一种在对话框中等待用户输入而不必提示用户输入的方法。典型的情况是,当您使用 HeroCard 进行回复时,您只是等待用户的反应,而不发送诸如“请从选项中选择”之类的急迫消息。
在 V4 中,我无法分别找到 context.Wait() 和 stepContext 等待方法,因此此行为的实现需要轻松四处走动,在下面的答案中提供。也许有更好的方法来实现它,如果你分享它会很高兴。
【问题讨论】:
标签:
dialog
botframework
bots
【解决方案1】:
你可以这样返回等待结果:
return new DialogTurnResult(DialogTurnStatus.Waiting);
【解决方案2】:
要在不提示用户文本的情况下实现等待行为,您可以像这样使用发送空提示:
return await stepContext.PromptAsync("<emptyPrompt>", new PromptOptions { }, cancellationToken);