-
Notifications
You must be signed in to change notification settings - Fork 39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Is there a blocking middleware implemented? #8
Comments
Hi @arg20 controller.hears('.*', ['direct_message', 'direct_mention', 'mention'], function (bot, message) {
apiai.process(message, bot);
}); something like controller.hears('.*', ['direct_message', 'direct_mention', 'mention'], function (bot, message) {
apiai.process(message, bot, function() {
// make some actions...
});
}); What about returning a Promise from controller.hears('.*', ['direct_message', 'direct_mention', 'mention'], function (bot, message) {
apiai.process(message, bot)
.then(() => {
// make some actions...
});
}); What do you think? Thanks! |
@xVir I meant more like I need to load something from the database. So after For instance, botkit has middleware that works like this:
Basically I don't want all the To be more concrete. Imagine this example:
|
@arg20 So, do you want to add |
Hi @arg20 worker.allCallback.forEach((callback) => {
callback(message, response, bot);
}); in way like this (using async lib): async.eachSeries(worker.allCallback, (item, next) => {
item(message, response, bot, next);
},
(err) => {
if (!err) {
// continue processing..,
} else {
// error...
}
}); But it will be a problem for those, who will update the lib and will not update sources with the So, any thoughts how to get around this? |
Botkit has middleware that allows you to call
next()
when you're done, allowing you to block the execution of future handlers until an async task is done. I need this but once theapiai
request has completed, so I can look at theresp.result
obj. Is there any such functionality available?I need something like:
The text was updated successfully, but these errors were encountered: