aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRapptz <[email protected]>2017-01-13 20:34:00 -0500
committerRapptz <[email protected]>2017-02-11 05:52:27 -0500
commite2de93e2a65960c9c83e8a2fe53d18c4f9600196 (patch)
tree125e071b92f6ab9b5fbb785ddc7c48580a3dafad
parentRemoved unused variables in routes. (diff)
downloaddiscord.py-e2de93e2a65960c9c83e8a2fe53d18c4f9600196.tar.xz
discord.py-e2de93e2a65960c9c83e8a2fe53d18c4f9600196.zip
[commands] Make Command a descriptor for #426.
-rw-r--r--discord/ext/commands/bot.py2
-rw-r--r--discord/ext/commands/core.py5
2 files changed, 5 insertions, 2 deletions
diff --git a/discord/ext/commands/bot.py b/discord/ext/commands/bot.py
index b0a86ebd..03bbd1cb 100644
--- a/discord/ext/commands/bot.py
+++ b/discord/ext/commands/bot.py
@@ -651,7 +651,6 @@ class Bot(GroupMixin, discord.Client):
for name, member in members:
# register commands the cog has
if isinstance(member, Command):
- member.instance = cog
if member.parent is None:
self.add_command(member)
continue
@@ -699,7 +698,6 @@ class Bot(GroupMixin, discord.Client):
for name, member in members:
# remove commands the cog has
if isinstance(member, Command):
- member.instance = None
if member.parent is None:
self.remove_command(member.name)
continue
diff --git a/discord/ext/commands/core.py b/discord/ext/commands/core.py
index ee525386..b04cdabb 100644
--- a/discord/ext/commands/core.py
+++ b/discord/ext/commands/core.py
@@ -163,6 +163,11 @@ class Command:
finally:
ctx.bot.dispatch('command_error', error, ctx)
+ def __get__(self, instance, owner):
+ if instance is not None:
+ self.instance = instance
+ return self
+
@asyncio.coroutine
def do_conversion(self, ctx, converter, argument):
if converter is bool: