From b335e9ea3098db5fd6d85304ed1e488f293e0798 Mon Sep 17 00:00:00 2001 From: Rapptz Date: Tue, 12 Jan 2016 00:35:41 -0500 Subject: [commands] Support invoking the help command with a cog name. --- discord/ext/commands/bot.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'discord/ext/commands/bot.py') 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) -- cgit v1.2.3