From 183e7341f6106805846e41e1e6d4a621014803ba Mon Sep 17 00:00:00 2001 From: Rapptz Date: Thu, 16 Jun 2016 05:42:28 -0400 Subject: [PATCH] [commands] Add Context.cog property. --- discord/ext/commands/context.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/discord/ext/commands/context.py b/discord/ext/commands/context.py index 7413eead8..013618214 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