diff options
| author | Rapptz <[email protected]> | 2019-03-16 09:24:17 -0400 |
|---|---|---|
| committer | Rapptz <[email protected]> | 2019-03-16 09:24:17 -0400 |
| commit | 8466250bcc97d160d824109258f90a74b327bb84 (patch) | |
| tree | b9ef1d0b28b381eb1d3c1ef94f3ec0bae4a3fb9e /discord/ext/commands/help.py | |
| parent | [commands] Add HelpCommand.get_bot_mapping helper. (diff) | |
| download | discord.py-8466250bcc97d160d824109258f90a74b327bb84.tar.xz discord.py-8466250bcc97d160d824109258f90a74b327bb84.zip | |
[commands] Assign context inside HelpCommand.prepare_help_command
Diffstat (limited to 'discord/ext/commands/help.py')
| -rw-r--r-- | discord/ext/commands/help.py | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/discord/ext/commands/help.py b/discord/ext/commands/help.py index 664485f3..375fe1be 100644 --- a/discord/ext/commands/help.py +++ b/discord/ext/commands/help.py @@ -686,7 +686,12 @@ class HelpCommand: some state in your subclass before the command does its processing then this would be the place to do it. - The default implementation is empty. + The default implementation sets :attr:`context`. + + .. warning:: + + If you override this method, be sure to call ``super()`` + so the help command can be set up. .. note:: @@ -700,7 +705,7 @@ class HelpCommand: command: Optional[:class:`str`] The argument passed to the help command. """ - return None + self.context = ctx async def command_callback(self, ctx, *, command=None): """|coro| @@ -722,7 +727,6 @@ class HelpCommand: - :meth:`prepare_help_command` """ - self.context = ctx await self.prepare_help_command(ctx, command) bot = ctx.bot @@ -898,6 +902,7 @@ class DefaultHelpCommand(HelpCommand): async def prepare_help_command(self, ctx, command): self.paginator.clear() + await super().prepare_help_command(ctx, command) async def send_bot_help(self, mapping): ctx = self.context @@ -1123,6 +1128,7 @@ class MinimalHelpCommand(HelpCommand): async def prepare_help_command(self, ctx, command): self.paginator.clear() + await super().prepare_help_command(ctx, command) async def send_bot_help(self, mapping): ctx = self.context |