Prompts work fine in the emulator and direct Skype chats with the bot, but when using group chats, I have to @mention the bot to send the message to it. However, when using Prompts, the result also contains the @mention.
E.g. With Prompts.text(), sending the message "@bot Test" leads to results.response = "@bot Test".
The biggest problem with this is when using Prompts.choice(), where choosing an option like "1" doesn't work because it is receiving "@bot 1", leading to the "I didn't understand. Please choose an option from the list." error.
Thanks
Have you looked at the entities collection. The mention information is usually sent in there with information so that you know that you can strip the @bot portion out.
The problem is that with Prompts.choice(), I can never get past that part of the of logic because it rejects my input on account of the @bot prefix. I can't get to a point where I can parse the response myself.
Thanks
We'll look at making a change to send only the text in the text field in future. For now @tomlm is there a way to detect the presence of @ mentions in entities and have the bot strip those from the text it uses with prompts?
I see a similar issue in Microsoft Teams when chatting in a team window. I am able to do a 1:1 chat with the bot just fine. However with the recent Teams GA, I can now add a chatbot to a team channel. Doing so requires you to prefix all messages to the bot with @botname, presumably so the bot doesn't start trying to reply to things not intended for it. This gets sent to my Bot Framework code and "breaks" the regex intent recognition. I think I can modify my regex to accommodate, but I think the expectation for a developer is that group chat and 1:1 chat behave the same, or at least an option be provided to strip the @botname prior to intent recognition. Maybe some middleware to take it out? One issue with having to strip out the botname in the bot code is that it could change or be part of a library intended for use with multiple bots.
Please fix this. @danroot suggestion of a middleware is just fine.
@stsquared99 @thelostcode for reference, are you using C# or Node SDK for BotBuilder?
@nwhitmont please correct this on C# too
@nwhitmont I had this issue on Node SDK.
related issue:
https://github.com/Microsoft/BotBuilder/issues/3067
I've also hit the same issue. On Node, this can be monkey patched, but it is highly unexpected to include @botname which is used to trigger the bot in the text.
var recognizer = new botbuilder.LuisRecognizer(process.env.LUIS_MODEL_URL);
var originalRecognize = recognizer.recognize;
recognizer.recognize = function(context, callback) {
if (context && context.message && context.message.text && context.message.text.toLowerCase().startsWith("@botname")) {
context.message.text = context.message.text.slice("@botname".length);
}
originalRecognize.apply(this, arguments);
}
bot.recognizer(recognizer);
We should make sure that the remove @ mention middleware is documented and if so add pointer to that and close this issue. If not, we should have @Kaiqb add a topic for this under handling group conversations with a chatbot and add a pointer to the topic.
Added item to VSTS for tracking this.
If you're using a separate source code and issue tracking system, and avoiding issues here, what's the point of having a github project?
Most helpful comment
I see a similar issue in Microsoft Teams when chatting in a team window. I am able to do a 1:1 chat with the bot just fine. However with the recent Teams GA, I can now add a chatbot to a team channel. Doing so requires you to prefix all messages to the bot with @botname, presumably so the bot doesn't start trying to reply to things not intended for it. This gets sent to my Bot Framework code and "breaks" the regex intent recognition. I think I can modify my regex to accommodate, but I think the expectation for a developer is that group chat and 1:1 chat behave the same, or at least an option be provided to strip the @botname prior to intent recognition. Maybe some middleware to take it out? One issue with having to strip out the botname in the bot code is that it could change or be part of a library intended for use with multiple bots.