aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRapptz <[email protected]>2016-01-30 20:29:58 -0500
committerRapptz <[email protected]>2016-01-30 20:29:58 -0500
commit17e17cade9cb0bba00dcfbc4b185323ef7b8d921 (patch)
treee7b57c9bf33682c9d48e5174f2b8c17dbbc5c241
parentMessage.clean_content now handles everyone mentions properly. (diff)
downloaddiscord.py-17e17cade9cb0bba00dcfbc4b185323ef7b8d921.tar.xz
discord.py-17e17cade9cb0bba00dcfbc4b185323ef7b8d921.zip
[commands] Fix crash when a group has no commands and help is requested
-rw-r--r--discord/ext/commands/formatter.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/discord/ext/commands/formatter.py b/discord/ext/commands/formatter.py
index 4451a4ce..45ed8350 100644
--- a/discord/ext/commands/formatter.py
+++ b/discord/ext/commands/formatter.py
@@ -104,7 +104,9 @@ class HelpFormatter:
the largest subcommand name."""
try:
commands = self.command.commands if not self.is_cog() else self.context.bot.commands
- return max(map(lambda c: len(c.name), commands.values()))
+ if commands:
+ return max(map(lambda c: len(c.name), commands.values()))
+ return 0
except AttributeError:
return len(self.command.name)