Duplicate Rating in Prompt.Choice

馋奶兔 提交于 2019-12-13 03:45:23

问题


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

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