Skip to content

Instantly share code, notes, and snippets.

@andreafalzetti
Last active December 14, 2016 22:53
Show Gist options
  • Save andreafalzetti/6a55b169b24811871d52c8ca712b4b45 to your computer and use it in GitHub Desktop.
Save andreafalzetti/6a55b169b24811871d52c8ca712b4b45 to your computer and use it in GitHub Desktop.
ChatBot.prototype.run = function(tasks, data) {
if(typeof tasks === "undefined" || tasks === null) {
tasks = this.getNextAction();
}
async.forEachOfLimit(tasks, 1, this.resolveAction.bind(this), err => {
if(err) {
console.log("Error", err);
} else {
if(typeof tasks.input === "undefined") {
if(!this.hasNextAction()){
console.log("The conversation is finished");
}
} else {
console.log("Waiting for user input...");
}
}
});
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment