Reputation: 897
I am trying to get the response to builder.Prompt.choice(...); The list of choices gets loaded and when I make a choice nothing happens.
But it doesn't seems like function(session, results)
ever gets executed.
session.send("Choice Made)
and the other code doesn't get executed. How can I get my response. I'm not sure what is going wrong here. It looks just like code from the docs.
bot.dialog('LifecycleDialog', function (session, args) {
var softwareEntity = builder.EntityRecognizer.findEntity(args.intent.entities, 'Software');
var choices = Object.keys(SoftwareDict[softwareEntity.entity]);
builder.Prompts.choice(session, "Select a version by typing the number: ", choices, "Sorry I don't see that version.");
},
function (session, results) {
session.send("Choice Made"); //DOES NOT WORK
session.endDialogWithResult(results); //DOES NOT WORK
}).triggerAction({
matches: 'LifecycleStatus'
});
Upvotes: 2
Views: 486
Reputation: 405
You should put the square brackets at the beginning of the functions part i.e. after the comma Like " 'LifecycleDialog', [ function (session, args) "
bot.dialog('LifecycleDialog', [
function (session, args) {
var softwareEntity = builder.EntityRecognizer.findEntity(args.intent.entities, 'Software');
var choices = Object.keys(SoftwareDict[softwareEntity.entity]);
builder.Prompts.choice(session, "Select a version by typing the number: ", choices, "Sorry I don't see that version.");
},
function (session, results) {
session.send("Choice Made"); //DOES NOT WORK
session.endDialogWithResult(results); //DOES NOT WORK
}
]).triggerAction({
matches: 'LifecycleStatus'
});
Upvotes: 3
Reputation: 897
I figured it out. The only difference is the dialog should have brackets [] instead of curly braces {}.
bot.dialog('LifecycleDialog', function (session, args) [
var softwareEntity = builder.EntityRecognizer.findEntity(args.intent.entities, 'Software');
var choices = Object.keys(SoftwareDict[softwareEntity.entity]);
builder.Prompts.choice(session, "Select a version by typing the number: ", choices, "Sorry I don't see that version.");
},
function (session, results) {
session.send("Choice Made"); //DOES NOT WORK
session.endDialogWithResult(results); //DOES NOT WORK
]).triggerAction({
matches: 'LifecycleStatus'
});
Upvotes: 0