mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-11-06 11:18:54 -05:00
[Docs] Clarify documentation for Context.clean_prefix (#4135)
* change docstring for Context.clean_prefix * "tyop"
This commit is contained in:
parent
068ce24513
commit
f65ff87b96
@ -259,14 +259,18 @@ class Context(DPYContext):
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def clean_prefix(self) -> str:
|
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
|
me = self.me
|
||||||
pattern = re.compile(rf"<@!?{me.id}>")
|
pattern = re.compile(rf"<@!?{me.id}>")
|
||||||
return pattern.sub(f"@{me.display_name}".replace("\\", r"\\"), self.prefix)
|
return pattern.sub(f"@{me.display_name}".replace("\\", r"\\"), self.prefix)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def me(self) -> Union[discord.ClientUser, discord.Member]:
|
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.
|
If the context is DM, this will be a `discord.User` object.
|
||||||
"""
|
"""
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user