Skip to content

Commit

Permalink
[commands] Add Command.cog_name to get the cog name it belongs to.
Browse files Browse the repository at this point in the history
  • Loading branch information
Rapptz committed Jan 11, 2016
1 parent 1e94192 commit c49efc5
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion discord/ext/commands/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -321,6 +322,11 @@ def error(self, coro):
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.
Expand Down

0 comments on commit c49efc5

Please sign in to comment.