[commands] Rework help command to avoid a deepcopy on invoke

This commit is contained in:
Josh
2022-03-19 20:34:19 +10:00
committed by GitHub
parent 94f4da9248
commit fafc5b13f6
2 changed files with 99 additions and 193 deletions

View File

@ -354,6 +354,7 @@ class Context(discord.abc.Messageable, Generic[BotT]):
"""
from .core import Group, Command, wrap_callback
from .errors import CommandError
from .help import _context
bot = self.bot
cmd = bot.help_command
@ -361,8 +362,8 @@ class Context(discord.abc.Messageable, Generic[BotT]):
if cmd is None:
return None
cmd = cmd.copy()
cmd.context = self # type: ignore
_context.set(self)
if len(args) == 0:
await cmd.prepare_help_command(self, None)
mapping = cmd.get_bot_mapping()