问题
I had Question in Bot Framework SDK V3. When the answer is selected, then the bot reply and the bot ask to rate again. Here with the screenshot. and Here with my code:
private const string fiverate = "★★★★★";
private const string fourrate = "★★★★";
private const string threerate = "★★★";
private const string tworate = "★★";
private const string Onerate = "★";
public async Task ShowRating(IDialogContext context)
{
PromptDialog.Choice(context,this.OnOptionRating, new List<string>() { fiverate,fourrate,threerate,tworate,Onerate }," "," ",3);
}
private async Task OnOptionRating(IDialogContext context, IAwaitable<string> result)
{
try
{
string optionSelected = await result;
switch (optionSelected)
{
case fiverate:
await context.PostAsync("Five Star");
context.Done(String.Empty);
break;
case fourrate:
await context.PostAsync("Four Star");
context.Done(String.Empty);
break;
case threerate:
await context.PostAsync("Three Star");
context.Done(String.Empty);
break;
case tworate:
await context.PostAsync("Two Star");
context.Done(String.Empty);
break;
case Onerate:
await context.PostAsync("One Star");
context.Done(String.Empty);
break;
}
}
catch (TooManyAttemptsException ex)
{
await context.PostAsync($"Ooops! Too many attemps :(. But don't worry, I'm handling that exception and you can try again!");
context.Wait(this.MessageReceivedAsync);
}
}
any solutions better for this? I had reference so many sample from Stack Overflow, but still not found the solutions.
Thank you.
回答1:
I had change to the waterfall model. Its solved my problems. Thank you.
来源:https://stackoverflow.com/questions/55312256/duplicate-rating-in-prompt-choice