Edhelvar
Edhelvar

Reputation: 186

Bot Builder: Change "recognize" options of promptdialogs

I am using the Bot Builder in C# and promptdialogs to ask my users for choices. It's working fine but I wanted to limit my users to use the buttons in the prompts, and from what I found is that I can supposedly set the recognizeOrdinals and recognizeNumbers and recognizeChoices to false to solve my issue. The thing is I can't seem to find a way to set these values.

I am using a prompt like this:

PromptDialog.Choice(context, ZipCodeUnavailableAnswerAsync, new List<string>() { "Mudar Código Postal", "Mudar Serviço", "Cancelar Pedido", "Apoio ao Cliente" }, "O que quer fazer?", "Desculpe, não percebi.");

I saw that I can also define separately the Promptoptions, but even then I can't seem to find how to set those 3 individual values to false, since I can't just change the value of "recognizer" to what I want, as far as I can tell.

var promptOptions = new PromptOptions<string>(
                        prompt: "O que quer fazer?",
                        retry: "Desculpe, não percebi.",
                        options: new List<string>() { "Mudar Código Postal", "Mudar Serviço", "Cancelar Pedido", "Apoio ao Cliente" },
                        recognizer: ;

Upvotes: 0

Views: 94

Answers (1)

Nicolas R
Nicolas R

Reputation: 14619

You can use this method:

public static void Choice<T> (Microsoft.Bot.Builder.Dialogs.IDialogContext context, Microsoft.Bot.Builder.Dialogs.ResumeAfter<T> resume, System.Collections.Generic.IDictionary<T,System.Collections.Generic.IEnumerable<T>> choices, string prompt, string retry = null, int attempts = 3, Microsoft.Bot.Builder.Dialogs.PromptStyle promptStyle = Microsoft.Bot.Builder.Dialogs.PromptStyle.Auto, System.Collections.Generic.IEnumerable<string> descriptions = null, bool recognizeChoices = true, bool recognizeNumbers = true, bool recognizeOrdinals = true, double minScore = 0.4);

So it will look like:

var promptOptions = new PromptOptions<string>(
    prompt: "O que quer fazer?",
    retry: "Desculpe, não percebi.",
    options: new List<string>() { "Mudar Código Postal", "Mudar Serviço", "Cancelar Pedido", "Apoio ao Cliente" };

PromptDialog.Choice(context: context, resume: ZipCodeUnavailableAnswerAsync, promptOptions: promptOptions, recognizeChoices: false, recognizeNumbers: false, recognizeOrdinals: false);

Upvotes: 1

Related Questions