From f65ff87b96688aa4293a9112aeab920170aff052 Mon Sep 17 00:00:00 2001 From: Dav Date: Thu, 6 Aug 2020 01:54:48 +0000 Subject: [PATCH] [Docs] Clarify documentation for Context.clean_prefix (#4135) * change docstring for Context.clean_prefix * "tyop" --- redbot/core/commands/context.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/redbot/core/commands/context.py b/redbot/core/commands/context.py index ca40e3e7f..2daa6e15f 100644 --- a/redbot/core/commands/context.py +++ b/redbot/core/commands/context.py @@ -259,14 +259,18 @@ class Context(DPYContext): @property def clean_prefix(self) -> str: - """str: The command prefix, but a mention prefix is displayed nicer.""" + """ + str: The command prefix, but with a sanitized version of the bot's mention if it was used as prefix. + This can be used in a context where discord user mentions might not render properly. + """ me = self.me pattern = re.compile(rf"<@!?{me.id}>") return pattern.sub(f"@{me.display_name}".replace("\\", r"\\"), self.prefix) @property def me(self) -> Union[discord.ClientUser, discord.Member]: - """discord.abc.User: The bot member or user object. + """ + discord.abc.User: The bot member or user object. If the context is DM, this will be a `discord.User` object. """