You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
The bot does not respond to pings that were copied if the bots name ends up capitalized. For instance, if you have the bot @bot, but it has a "nice" name of @Bot, copying a message that contains the nice @Bot fails to trigger a requires_mention action.
How To Reproduce
Create a bot with a lowercase name (e.g. @bot).
Give the bot a name case nice name (e.g. Bot).
Create a requires_mention plugin/task called mytask.
Send a ping to the bot manually (@bot mytask)
Copy the resulting text which should be @Bot mytask).
Send the resulting text.
Task fails to trigger.
Expected behavior
The bot should respond to a ping with either name format, @bot or @Bot, as Mattermost treats these as equivalent.
Operating Environment (please complete the following information):
Additional context
It looks like the problem is with https://github.com/attzonko/mmpy_bot/blob/main/mmpy_bot/event_handler.py#L31. This doesn't ignore case, so when the message with a capitalized ping comes in, it doesn't match and get stripped out. I was looking for a later point to try to fix this but don't see the obvious path for what triggers needs_mention to be True, so this seems like the simplest solution.
The text was updated successfully, but these errors were encountered:
Did a bit more digging, and the Messagementions uses the actual Mattermost ID, not the human-readable name, so the failure to match must be happening earlier than the check in https://github.com/attzonko/mmpy_bot/blob/main/mmpy_bot/function.py#L136. So I'm pretty sure the lowercase check above is the only real way to fix this.
This is a known limitation and one that I'm not sure we should address.
The current behavior targets usernames, which are unique. Displayed names aren't which could cause confusion if you happen to have multiple bots with similar/identical names.
I would consider this feature only if made optional.
Either way, Mattermost will always tab-complete the username if typing @.... This is the intended way of use.
Note that uppercase/lowercase is just one of the possible cases. If the bot has a completely different name from its username, lowercase/uppercase wouldn't make it different.
Describe the bug
The bot does not respond to pings that were copied if the bots name ends up capitalized. For instance, if you have the bot
@bot
, but it has a "nice" name of@Bot
, copying a message that contains the nice@Bot
fails to trigger arequires_mention
action.How To Reproduce
@bot
).Bot
).requires_mention
plugin/task calledmytask
.@bot mytask
)@Bot mytask
).Expected behavior
The bot should respond to a ping with either name format,
@bot
or@Bot
, as Mattermost treats these as equivalent.Operating Environment (please complete the following information):
Additional context
It looks like the problem is with https://github.com/attzonko/mmpy_bot/blob/main/mmpy_bot/event_handler.py#L31. This doesn't ignore case, so when the message with a capitalized ping comes in, it doesn't match and get stripped out. I was looking for a later point to try to fix this but don't see the obvious path for what triggers
needs_mention
to beTrue
, so this seems like the simplest solution.The text was updated successfully, but these errors were encountered: