drakedog drakedog - 1 year ago 217
Node.js Question

Cancel builder.Prompts.choice()

My bot has a prompt that asks for user input:

builder.Prompts.choice(session, "Is it ok?", ["Yes", "No"]);

Now, when a user responds with something else other than "Yes" or "No" the program will always reply with:

I did not understand. Please choose an option from the list

with the same choices as before.

I would like the bot to not ask for input again if the user types something else other than "Yes" or "No" (and reset the prompt stack so).

Answer Source

You can change the maxRetries option for the prompt as shown (default is infinite)

builder.Prompts.choice(session, "Is it ok?", ["Yes", "No"],maxRetries:'2'); 

You can see the IPrompt options in the mentioned URL


Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download