[commands] Make Command a descriptor for #426.

This commit is contained in:
Rapptz 2017-01-13 20:34:00 -05:00
parent ae30d2a880
commit e2de93e2a6
2 changed files with 5 additions and 2 deletions

View File

@ -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

View File

@ -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: