aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRapptz <[email protected]>2016-01-11 00:35:07 -0500
committerRapptz <[email protected]>2016-01-11 00:35:07 -0500
commitc49efc54122ea3567d2b6119e3b9cd91cebe92c7 (patch)
treee851d21dbdf17f51f8ba25edccced9763060d89a
parent[commands] Add Command.clean_params to have nicer params. (diff)
downloaddiscord.py-c49efc54122ea3567d2b6119e3b9cd91cebe92c7.tar.xz
discord.py-c49efc54122ea3567d2b6119e3b9cd91cebe92c7.zip
[commands] Add Command.cog_name to get the cog name it belongs to.
-rw-r--r--discord/ext/commands/core.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/discord/ext/commands/core.py b/discord/ext/commands/core.py
index 63f57242..fad133dc 100644
--- a/discord/ext/commands/core.py
+++ b/discord/ext/commands/core.py
@@ -71,7 +71,8 @@ class Command:
help : str
The long help text for the command.
brief : str
- The short help text for the command.
+ The short help text for the command. If this is not specified
+ then the first line of the long help text is used instead.
aliases : list
The list of aliases the command can be invoked under.
pass_context : bool
@@ -321,6 +322,11 @@ class Command:
self.on_error = coro
return coro
+ @property
+ def cog_name(self):
+ """The name of the cog this command belongs to. None otherwise."""
+ return type(self.instance).__name__ if self.instance is not None else None
+
class GroupMixin:
"""A mixin that implements common functionality for classes that behave
similar to :class:`Group` and are allowed to register commands.