diff options
| author | Rapptz <[email protected]> | 2016-01-12 00:35:41 -0500 |
|---|---|---|
| committer | Rapptz <[email protected]> | 2016-01-12 00:45:45 -0500 |
| commit | b335e9ea3098db5fd6d85304ed1e488f293e0798 (patch) | |
| tree | a87da29f49297efa81649d33c1f38e301090973f /discord/ext/commands/bot.py | |
| parent | [commands] Initial implementation of help command. (diff) | |
| download | discord.py-b335e9ea3098db5fd6d85304ed1e488f293e0798.tar.xz discord.py-b335e9ea3098db5fd6d85304ed1e488f293e0798.zip | |
[commands] Support invoking the help command with a cog name.
Diffstat (limited to 'discord/ext/commands/bot.py')
| -rw-r--r-- | discord/ext/commands/bot.py | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/discord/ext/commands/bot.py b/discord/ext/commands/bot.py index 2b2ad625..11a5e751 100644 --- a/discord/ext/commands/bot.py +++ b/discord/ext/commands/bot.py @@ -61,11 +61,24 @@ def _default_help_command(ctx, *commands : str): # help by itself just lists our own commands. if len(commands) == 0: pages = bot.formatter.format_help_for(ctx, bot) + elif len(commands) == 1: + # try to see if it is a cog name + name = commands[0] + command = None + if name in bot.cogs: + command = bot.cogs[name] + else: + command = bot.commands.get(name) + if command is None: + yield from bot.send_message(destination, 'No command called "{}" found.'.format(name)) + return + + pages = bot.formatter.format_help_for(ctx, command) else: try: command = functools.reduce(dict.__getitem__, commands, bot.commands) except KeyError as e: - yield from bot.send_message(destination, 'No command called {} found.'.format(e)) + yield from bot.send_message(destination, 'No command called "{}" found.'.format(e)) return pages = bot.formatter.format_help_for(ctx, command) |