I was recently developing a chatbot using Microsoft\'s botframework. I am using prompt.confirm to take user\'s yes/no input but it shows too many attempts exception when I
I resolved this issue by overriding the PromptOptions constructor, Thanks to ezequiel. I used PromptDialog.Choice to achieve it however I could also have done it with confirm. Here's what I did
List<string> questions = new List<string>();
questions.Add("Yes"); // Added yes option to prompt
questions.Add("No"); // Added no option to prompt
string QuestionPrompt = "Are you sure?";
PromptOptions<string> options = new PromptOptions<string>(QuestionPrompt, "", "", questions, 1); // Overrided the PromptOptions Constructor.
PromptDialog.Choice<string>(context, NextQuestionAsync, options);
You can just override the TooManyAttempts
message by passing your own string in the PromptOptions constructor, which is later used here to display the message.
Also, have in mind that in the case of the TooManyAttempts
exception, the way to handle it is in the try/catch of the ResumeAfter
method (in this case your NextQuestionAsync
method), surrounding the await
and not in the caller method.