[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
This commit is contained in:
Michael H 2018-05-14 06:13:12 -04:00 committed by Tobotimus
parent cbbeb412f9
commit e7476edd68
2 changed files with 9 additions and 2 deletions

View File

@ -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):

View File

@ -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