I've a code which is displayed below and the problem is that the userFailedC prop isn't getting incremented. I can set property but its value resets each time user's intent is not matched, i.e. each time .onDefault is executed. Am I doing something wrong? Also, I tried with userData and privateConversationData so I would bet that I misunderstood something. Thank you!
bot.dialog('/', new builder.IntentDialog()
.matches(/(hi|hello|hey)/i, function(session, args, next) {
session.send(rm.get('Hi!');
session.beginDialog('/showMainMenu');
})
.onDefault(function(session, args, next) {
if ( session.dialogData.userFailedC === undefined ) {
session.dialogData.userFailedC = 1;
} else {
session.dialogData.userFailedC++;
}
if (session.dialogData.userFailedC % 2 == 0) {
session.send('Please say hi to me!');
}
})
.onBegin(function(session, args, next) {
next();
})
);
via BB04Deng
No comments:
Post a Comment