Skip to content

Commit

Permalink
respect name boundaries
Browse files Browse the repository at this point in the history
  • Loading branch information
genekogan committed Jul 6, 2024
1 parent f991621 commit 62acb27
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/common/discord.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ def is_mentioned(message: discord.Message, user: discord.User) -> bool:
:return: True if the user is mentioned, False otherwise.
"""
bot_name = message.guild.me.name
name_mentioned = bot_name.lower() in message.content.lower()
# name_mentioned = bot_name.lower() in message.content.lower()
name_mentioned = re.search(rf"\b{re.escape(bot_name.lower())}\b", message.content.lower()) is not None
return name_mentioned or user.id in [m.id for m in message.mentions]


Expand Down

0 comments on commit 62acb27

Please sign in to comment.