You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, Maybe I am just not using this correctly but when I have a conversation in which the bot is asking several questions in succession as in the snippet below, the default callback is not invoked. I confirmed this by commenting out other asks and just leaving the one with the default and in that case the default callback in invoked (as is the case with the sample code 'Shall we proceed Say YES, NO or DONE to quit.')
convo.ask('Any more to say?',[{pattern: bot.utterances.no,callback: function(response,convo){convo.say('Moving on..');convo.next();}},{pattern: bot.utterances.yes,callback: function(response,convo){convo.say('Great! I will continue...');convo.next();}},{default: true,callback: function(response,convo){// just repeat the question convo.say('Repeating..');convo.repeat();convo.next();}}]);convo.ask(username+', what did you do last year?',[{pattern: '.*',callback: function(response,convo){console.log(response);//convo.say(username + ', what are you doing today?')convo.next();}}]);```
The text was updated successfully, but these errors were encountered:
@adphillips The issue here is that using convo.ask twice in a row. This causes the 2 questions to be added sequentially into the queue instead of waiting for the answer to add the second question.
To get your expected results, but the second convo.ask inside the callback.
One way to do this is to encapsulate each step of the conversation into a function that can be called from inside the callbacks.
Hi, Maybe I am just not using this correctly but when I have a conversation in which the bot is asking several questions in succession as in the snippet below, the default callback is not invoked. I confirmed this by commenting out other asks and just leaving the one with the default and in that case the default callback in invoked (as is the case with the sample code 'Shall we proceed Say YES, NO or DONE to quit.')
The text was updated successfully, but these errors were encountered: