mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-11-21 10:17:59 -05:00
Fix ctx.clean_prefix for *new* discord behavior (#3249)
* I just love when discord changes important syntax without warning - sarcasm approaching dangerous levels * changelog
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import asyncio
|
||||
import contextlib
|
||||
import re
|
||||
from typing import Iterable, List, Union
|
||||
import discord
|
||||
from discord.ext import commands
|
||||
@@ -249,7 +250,8 @@ class Context(commands.Context):
|
||||
def clean_prefix(self) -> str:
|
||||
"""str: The command prefix, but a mention prefix is displayed nicer."""
|
||||
me = self.me
|
||||
return self.prefix.replace(me.mention, f"@{me.display_name}")
|
||||
pattern = re.compile(rf"<@!?{me.id}>")
|
||||
return pattern.sub(f"@{me.display_name}", self.prefix)
|
||||
|
||||
@property
|
||||
def me(self) -> discord.abc.User:
|
||||
|
||||
Reference in New Issue
Block a user