1

I ask the user a yes/no question using:

PromptDialog.Confirm(context, AfterChoice_OpenServiceRequest, "Do you want to open a service request?");

to which the user can give a yes/no answer. But, what if the user doesn't want to answer to this at all and rather, ask a different question? Until and unless the user replies with a yes/no, it keeps asking them the same question for 'n' number of times.

I could pass n=0 to attempts parameter, but that would still require the user to answer with a yes/no at least once before being able to ask something else.

Could the user not just proceed and ask something else in response? How can I handle this?

5
  • How would the user ask for something else on a yes/no dialog system, im confused.. Commented Dec 12, 2016 at 14:16
  • You're fighting the default behaviour, which might indicate you're using the wrong dialogue type. Commented Dec 12, 2016 at 14:16
  • @maximdumont, just like humans may do. I ask you a question, you reply with something like: "Leave that aside for a second and tell me what I need to do to get admin rights on the system" Commented Dec 12, 2016 at 14:23
  • @stuartd I see. Could this situation not arise in every dialog type? If not, it'd be great if you could point me in the right direction? Commented Dec 12, 2016 at 14:25
  • The built in prompt dialogs are just too inflexible for that use case. The Confirm dialogue is analogous to a Winforms MessageBox - you get "Yes" and "No" as your responses, and that's all your options. However you could create your own prompt class inheriting from maybe Prompt<bool?, string> (using the source as a reference) which parses for true/false and if not found looks for the other intent. Commented Dec 12, 2016 at 14:54

2 Answers 2

1

The pre-release version of the the SDK contains the concept of "triggerActions". You can use these to interrupt any Dialog. In the sample below, the user can interrupt the color prompt, by typing "weather":

enter image description here

Code:

bot.dialog('/', function (session) {
    builder.Prompts.choice(session, "What color?", "Red|White|Blue");
});

bot.dialog("weather", function (session) {
    session.send("It's cold and rainy");
    session.endDialog();
}).triggerAction({ matches: /^weather/i});

To get the pre-release:

npm install -save botbuilder@next

Sign up to request clarification or add additional context in comments.

1 Comment

Hey @lars, and how about those using the C# SDK? :)
0

Until the release of the feature mentioned by Lars, the only option is to create a new class that would inherit from PromptDialog, or implement your conversation logic manually.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.