aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRapptz <[email protected]>2019-03-16 09:23:34 -0400
committerRapptz <[email protected]>2019-03-16 09:23:34 -0400
commitb728061522bfee847af6742449e6e0c43a840ada (patch)
tree7fc9c9873ec4657e551418e2447d854868c26cde
parent[commands] Return result of send_group_help and send_command_help (diff)
downloaddiscord.py-b728061522bfee847af6742449e6e0c43a840ada.tar.xz
discord.py-b728061522bfee847af6742449e6e0c43a840ada.zip
[commands] Add HelpCommand.get_bot_mapping helper.
-rw-r--r--discord/ext/commands/help.py16
1 files changed, 11 insertions, 5 deletions
diff --git a/discord/ext/commands/help.py b/discord/ext/commands/help.py
index 1898be4e..664485f3 100644
--- a/discord/ext/commands/help.py
+++ b/discord/ext/commands/help.py
@@ -294,6 +294,16 @@ class HelpCommand:
self._command_impl._eject_cog()
self._command_impl = None
+ def get_bot_mapping(self):
+ """Retrieves the bot mapping passed to :meth:`send_bot_help`."""
+ bot = self.context.bot
+ mapping = {
+ cog: cog.get_commands()
+ for cog in bot.cogs.values()
+ }
+ mapping[None] = [c for c in bot.all_commands.values() if c.cog is None]
+ return mapping
+
@property
def clean_prefix(self):
"""The cleaned up invoke prefix. i.e. mentions are ``@name`` instead of ``<@id>``."""
@@ -717,11 +727,7 @@ class HelpCommand:
bot = ctx.bot
if command is None:
- mapping = {
- cog: cog.get_commands()
- for cog in bot.cogs.values()
- }
- mapping[None] = [c for c in bot.all_commands.values() if c.cog is None]
+ mapping = self.get_bot_mapping()
return await self.send_bot_help(mapping)
# Check if it's a cog