diff options
| author | Rapptz <[email protected]> | 2019-03-14 03:53:19 -0400 |
|---|---|---|
| committer | Rapptz <[email protected]> | 2019-03-14 11:42:09 -0400 |
| commit | 27c6d2c923993b046b0da57cb934a8ec1899ce6e (patch) | |
| tree | 63531039540d1f6a12fdfa4274b394c04544c71b /discord/ext/commands/cog.py | |
| parent | [commands] Add Cog.qualified_name to query the specified cog name. (diff) | |
| download | discord.py-27c6d2c923993b046b0da57cb934a8ec1899ce6e.tar.xz discord.py-27c6d2c923993b046b0da57cb934a8ec1899ce6e.zip | |
[commands] Add Cog.description to get the clean docstring.
Diffstat (limited to 'discord/ext/commands/cog.py')
| -rw-r--r-- | discord/ext/commands/cog.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/discord/ext/commands/cog.py b/discord/ext/commands/cog.py index afcfd9c5..425b6300 100644 --- a/discord/ext/commands/cog.py +++ b/discord/ext/commands/cog.py @@ -181,6 +181,15 @@ class Cog(metaclass=CogMeta): """:class:`str`: Returns the cog's specified name, not the class name.""" return self.__cog_name__ + @property + def description(self): + """:class:`str`: Returns the cog's description, typically the cleaned docstring.""" + try: + return self.__cog_cleaned_doc__ + except AttributeError: + self.__cog_cleaned_doc__ = cleaned = inspect.getdoc(self) + return cleaned + def walk_commands(self): """An iterator that recursively walks through this cog's commands and subcommands.""" from .core import GroupMixin |