Last active
December 14, 2016 22:53
-
-
Save andreafalzetti/6a55b169b24811871d52c8ca712b4b45 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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