Open NxP4Code opened 3 years ago
You have an easy workaround of calling next()
after await watsonMiddleware.receive(bot, message);
.
It is up to you to implement next
parameter in receive method and raise a pull request.
what is puzzling to me is, why does wrapper doesn't work and direct receive middleware registration works. My understanding is in both cases next is not implemented.
The following does work, I am still confused why does it work when I do direct middleware registration which doesn't call next().
const receiveMiddleware = async (bot, message, next) => {
if (message.text && message.type == 'direct_message') {
await watsonMiddleware.receive(bot, message);
next();
} else {
next();
}
};
controller.middleware.receive.use(receiveMiddleware);
I am trying to filter messages passed to the Watson. I followed the step to use the wrapper function.
Receive function gets registered and it gets executed. Problem is that the following hears function doesn't get triggered. I made sure the intent is matching.
Above mentioned hears function gets triggered fine with the following receive handler.