From e7476edd683af78d5c541588e8572b87c9263921 Mon Sep 17 00:00:00 2001 From: Michael H Date: Mon, 14 May 2018 06:13:12 -0400 Subject: [PATCH] [V3] fix help on missing cog and command docstrings (#1645) * [V3] fix help on missing cog docstrings * I think this is what you're looking for * Also do a NoneType check for commands --- redbot/core/commands/commands.py | 5 ++++- redbot/core/help_formatter.py | 6 +++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/redbot/core/commands/commands.py b/redbot/core/commands/commands.py index bfcd87e65..332441aa0 100644 --- a/redbot/core/commands/commands.py +++ b/redbot/core/commands/commands.py @@ -38,7 +38,10 @@ class Command(commands.Command): translator = lambda s: s else: translator = self.translator - return inspect.cleandoc(translator(self.callback.__doc__)) + command_doc = self.callback.__doc__ + if command_doc is None: + return '' + return inspect.cleandoc(translator(command_doc)) @help.setter def help(self, value): diff --git a/redbot/core/help_formatter.py b/redbot/core/help_formatter.py index b0d2984cb..9bcf3c2dc 100644 --- a/redbot/core/help_formatter.py +++ b/redbot/core/help_formatter.py @@ -136,7 +136,11 @@ class Help(formatter.HelpFormatter): if self.is_cog(): translator = getattr(self.command, '__translator__', lambda s: s) - description = inspect.cleandoc(translator(self.command.__doc__)) + description = ( + inspect.cleandoc(translator(self.command.__doc__)) + if self.command.__doc__ + else EMPTY_STRING + ) else: description = self.command.description