aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael H <[email protected]>2018-06-07 16:56:01 -0400
committerRapptz <[email protected]>2018-08-22 21:06:09 -0400
commit39cb5f30b4cc4dca553ab32f1019284dc8c23802 (patch)
tree97c4dfb67e7a449f87a450c572b07f581746d52b
parentRemoves redundant asyncio import (diff)
downloaddiscord.py-39cb5f30b4cc4dca553ab32f1019284dc8c23802.tar.xz
discord.py-39cb5f30b4cc4dca553ab32f1019284dc8c23802.zip
[commands] Handle nick mentions in HelpFormatter
Modifies the help formatter to handle nicknamed bot users for mentions in clean_prefix
-rw-r--r--discord/ext/commands/formatter.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/discord/ext/commands/formatter.py b/discord/ext/commands/formatter.py
index 0dead85f..f65e29dc 100644
--- a/discord/ext/commands/formatter.py
+++ b/discord/ext/commands/formatter.py
@@ -181,12 +181,12 @@ class HelpFormatter:
@property
def clean_prefix(self):
"""The cleaned up invoke prefix. i.e. mentions are ``@name`` instead of ``<@id>``."""
- user = self.context.bot.user
+ user = self.context.guild.me if self.context.guild else self.context.bot.user
# this breaks if the prefix mention is not the bot itself but I
# consider this to be an *incredibly* strange use case. I'd rather go
# for this common use case rather than waste performance for the
# odd one.
- return self.context.prefix.replace(user.mention, '@' + user.name)
+ return self.context.prefix.replace(user.mention, '@' + user.display_name)
def get_command_signature(self):
"""Retrieves the signature portion of the help page."""