From 13355f37120f6e8eaf91d00886215ba9c8ea4ebf Mon Sep 17 00:00:00 2001 From: Stocker <44980366+StockerMC@users.noreply.github.com> Date: Sun, 6 Mar 2022 23:02:01 -0500 Subject: [PATCH] Fix HelpCommand.invoked_with raising an error This would happen if the context hasn't been set yet. --- discord/ext/commands/help.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/discord/ext/commands/help.py b/discord/ext/commands/help.py index 6c488aef1..78982187f 100644 --- a/discord/ext/commands/help.py +++ b/discord/ext/commands/help.py @@ -45,6 +45,8 @@ __all__ = ( 'MinimalHelpCommand', ) +MISSING = discord.utils.MISSING + # help -> shows info of bot on top/bottom and lists subcommands # help command -> shows detailed info of command # help command -> same as above @@ -318,7 +320,7 @@ class HelpCommand: self.command_attrs = attrs = options.pop('command_attrs', {}) attrs.setdefault('name', 'help') attrs.setdefault('help', 'Shows this message') - self.context: Context = discord.utils.MISSING + self.context: Context = MISSING self._command_impl = _HelpCommandImpl(self, **self.command_attrs) def copy(self): @@ -398,7 +400,7 @@ class HelpCommand: """ command_name = self._command_impl.name ctx = self.context - if ctx is None or ctx.command is None or ctx.command.qualified_name != command_name: + if ctx is MISSING or ctx.command is None or ctx.command.qualified_name != command_name: return command_name return ctx.invoked_with