howdyai / botkit-middleware-witai

Middleware for using Wit.ai with Botkit-powered bots
MIT License
87 stars 49 forks source link

not calling next() if empty message recieved #1

Open Stevenic opened 8 years ago

Stevenic commented 8 years ago

Doubt it will happen but you should probably call next() if you don't have message,text

middleware.receive = function(bot, message, next) {
    if (message.text) {
        wit.captureTextIntent(config.token, message.text, function(err, res) {
            if (err) {
                next(err);
            } else {
                console.log(JSON.stringify(res));
                message.intents = res.outcomes;
                next();
            }
        });
    }

};
benbrown commented 8 years ago

Doh! Good catch.