diff options
| author | Rapptz <[email protected]> | 2016-05-01 07:06:02 -0400 |
|---|---|---|
| committer | Rapptz <[email protected]> | 2016-05-01 07:06:19 -0400 |
| commit | fdaa4299a3f0a729c64c3e3fc3de41b3cbc25ba7 (patch) | |
| tree | 5ef7297c3dbadaa998de1aa8189a0cf652ae90b6 | |
| parent | Make Permissions partially-ordered. (diff) | |
| download | discord.py-fdaa4299a3f0a729c64c3e3fc3de41b3cbc25ba7.tar.xz discord.py-fdaa4299a3f0a729c64c3e3fc3de41b3cbc25ba7.zip | |
[commands] Fix when_mentioned when handling nicknames.
| -rw-r--r-- | discord/ext/commands/bot.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/discord/ext/commands/bot.py b/discord/ext/commands/bot.py index 3f4fa34d..9192fac1 100644 --- a/discord/ext/commands/bot.py +++ b/discord/ext/commands/bot.py @@ -49,6 +49,9 @@ def _get_variable(name): def when_mentioned(bot, msg): """A callable that implements a command prefix equivalent to being mentioned, e.g. ``@bot ``.""" + server = msg.server + if server is not None: + return '{0.me.mention} '.format(server) return '{0.user.mention} '.format(bot) def when_mentioned_or(*prefixes): @@ -67,7 +70,7 @@ def when_mentioned_or(*prefixes): """ def inner(bot, msg): r = list(prefixes) - r.append('{0.user.mention} '.format(bot)) + r.append(when_mentioned(bot, msg)) return r return inner |