Bot Framework V4 Dialog wait for user input withou

2019-08-18 03:34发布

问题:

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);