From d18f14c173f84dc58f51476da9833f000a208fab Mon Sep 17 00:00:00 2001 From: z03h <7235242+z03h@users.noreply.github.com> Date: Wed, 29 May 2024 20:24:28 -0700 Subject: [PATCH] [commands] fix HelpCommand not carrying over checks update command impl over creating new one --- discord/ext/commands/help.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/discord/ext/commands/help.py b/discord/ext/commands/help.py index 163bc2694..d06fbd8bf 100644 --- a/discord/ext/commands/help.py +++ b/discord/ext/commands/help.py @@ -297,6 +297,11 @@ class _HelpCommandImpl(Command): # Revert `on_error` to use the original one in case of race conditions self.on_error = self._injected.on_help_command_error + def update(self, **kwargs: Any) -> None: + cog = self.cog + self.__init__(self._original, **dict(self.__original_kwargs__, **kwargs)) + self.cog = cog + class HelpCommand: r"""The base implementation for help command formatting. @@ -377,9 +382,8 @@ class HelpCommand: return obj def _add_to_bot(self, bot: BotBase) -> None: - command = _HelpCommandImpl(self, **self.command_attrs) - bot.add_command(command) - self._command_impl = command + self._command_impl.update(**self.command_attrs) + bot.add_command(self._command_impl) def _remove_from_bot(self, bot: BotBase) -> None: bot.remove_command(self._command_impl.name)