aboutsummaryrefslogtreecommitdiff
path: root/discord/ext
diff options
context:
space:
mode:
authorRapptz <[email protected]>2016-06-16 05:42:28 -0400
committerRapptz <[email protected]>2016-06-16 05:42:28 -0400
commit183e7341f6106805846e41e1e6d4a621014803ba (patch)
tree941669d675dea218bb0f72c8e40dfca9d31c63c1 /discord/ext
parentDon't assume that any shared fields are optional in Client.edit_channel. (diff)
downloaddiscord.py-183e7341f6106805846e41e1e6d4a621014803ba.tar.xz
discord.py-183e7341f6106805846e41e1e6d4a621014803ba.zip
[commands] Add Context.cog property.
Diffstat (limited to 'discord/ext')
-rw-r--r--discord/ext/commands/context.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/discord/ext/commands/context.py b/discord/ext/commands/context.py
index 7413eead..01361821 100644
--- a/discord/ext/commands/context.py
+++ b/discord/ext/commands/context.py
@@ -115,3 +115,10 @@ class Context:
ret = yield from command.callback(*arguments, **kwargs)
return ret
+ @property
+ def cog(self):
+ """Returns the cog associated with this context's command. None if it does not exist."""
+
+ if self.command is None:
+ return None
+ return self.command.instance