aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRapptz <[email protected]>2017-04-24 00:13:27 -0400
committerRapptz <[email protected]>2017-04-24 00:13:27 -0400
commitc005ef5d4415a575e47fbb91a9c354d80ebf1d43 (patch)
treee4367d72bf1e2d1d031af837eb047c5c6294487d
parentWait 5 seconds before attempting to RESUME during INVALIDATE_SESSION. (diff)
downloaddiscord.py-c005ef5d4415a575e47fbb91a9c354d80ebf1d43.tar.xz
discord.py-c005ef5d4415a575e47fbb91a9c354d80ebf1d43.zip
[commands] Make when_mentioned always have both mention formats.
This will allow it to work in mobile clients which don't respect the <@!id> format in case of nicknames.
-rw-r--r--discord/ext/commands/bot.py7
1 files changed, 2 insertions, 5 deletions
diff --git a/discord/ext/commands/bot.py b/discord/ext/commands/bot.py
index 0f09af84..43254a4d 100644
--- a/discord/ext/commands/bot.py
+++ b/discord/ext/commands/bot.py
@@ -41,10 +41,7 @@ from .formatter import HelpFormatter
def when_mentioned(bot, msg):
"""A callable that implements a command prefix equivalent
to being mentioned, e.g. ``@bot ``."""
- guild = msg.guild
- if guild is not None:
- return '{0.me.mention} '.format(guild)
- return '{0.user.mention} '.format(bot)
+ return [bot.user.mention, '<@!%s>' % bot.user.id]
def when_mentioned_or(*prefixes):
"""A callable that implements when mentioned or other prefixes provided.
@@ -62,7 +59,7 @@ def when_mentioned_or(*prefixes):
"""
def inner(bot, msg):
r = list(prefixes)
- r.append(when_mentioned(bot, msg))
+ r.extend(when_mentioned(bot, msg))
return r
return inner