From 6d899b036ed83370bf6b8ce3642b227831aec554 Mon Sep 17 00:00:00 2001 From: CMDR furrycat Date: Fri, 14 Feb 2020 15:36:00 +0000 Subject: [PATCH] Handle mentions with <@!id>. --- app.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app.py b/app.py index 0a1d628..adc8eaa 100644 --- a/app.py +++ b/app.py @@ -295,6 +295,9 @@ def mentioned_in(message, explicit = True): if message.channel.is_private: return True if not client.user.mentioned_in(message): + m = re.match('<@!{}>'.format(client.user.id), message.content) + if m is not None: + return True return False if explicit: for member in message.mentions: @@ -328,7 +331,7 @@ async def on_message(message): return # Strip our mention from the message. - raw = re.sub('<@{}>'.format(client.user.id), '', message.content).strip() + raw = re.sub('<@!?{}>'.format(client.user.id), '', message.content).strip() # Handle copy/paste; Discord client will prepend (BOT): to pasted # text. Deal with the common cases of the user copying his own message -- 2.7.4