-
Notifications
You must be signed in to change notification settings - Fork 49
message sent to wit.ai contains @mention #2
Comments
I tried to wrap controller.middleware.receive.use(function (bot, message, next) {
if (message.text) {
var reg = new RegExp('^<@' + bot.identity.id + '>:?\s?');
message.text = message.text.replace(reg, '').trim();
wit.receive(bot, message, next);
}
}); EDIT: this solves the problem with sending the message to wit.ai with the user ID stripped, but it breaks the hears middleware. Seems like botkit may be matching against that string to determine "direct_mention", so if the bot userid is not there it won't even get passed to |
Any news about this? |
No news. I'm still seeing the issue with this and https://github.com/abeai/botkit-middleware-apiai. I think it needs to be fixed within the |
@simpixelated I thought sending the @user_id to wit.ai was the expected behaviour, so in wit.ai I marked the @user_id as a contact and wit.ai began to correctly determine the intent of the phrase. |
@simpixelated Sorry I missed your message. I was including both, but after using wit.ai with actual users, I'm finding it is still not working very well, even with single word commands. I don't have a solution yet, for now I just disabled wit. |
The
message.text
value passed to themiddleware.receive
function contains the username mentioned, which means it gets set to wit.ai. For example, a "direct_mention" shows up in wit.ai as:<@U0ZA78R19> testing pt 2
. This may be an issue with how https://github.com/howdyai/botkit works, but is there any way to strip out the user prior to passing it towit.captureTextIntent
in the case of "direct_mention" and "direct_message"?The text was updated successfully, but these errors were encountered: