[commands] Change GroupMixin.commands to all_commands

This is a breaking change as GroupMixin.commands now returns a set
of unique Command objects.
This commit is contained in:
Rapptz
2017-03-20 23:59:23 -04:00
parent c90e52450a
commit fe588a4d52
3 changed files with 25 additions and 20 deletions

View File

@@ -93,7 +93,7 @@ def _default_help_command(ctx, *commands : str):
if name in bot.cogs:
command = bot.cogs[name]
else:
command = bot.commands.get(name)
command = bot.all_commands.get(name)
if command is None:
yield from destination.send(bot.command_not_found.format(name))
return
@@ -101,7 +101,7 @@ def _default_help_command(ctx, *commands : str):
pages = yield from bot.formatter.format_help_for(ctx, command)
else:
name = _mention_pattern.sub(repl, commands[0])
command = bot.commands.get(name)
command = bot.all_commands.get(name)
if command is None:
yield from destination.send(bot.command_not_found.format(name))
return
@@ -109,7 +109,7 @@ def _default_help_command(ctx, *commands : str):
for key in commands[1:]:
try:
key = _mention_pattern.sub(repl, key)
command = command.commands.get(key)
command = command.all_commands.get(key)
if command is None:
yield from destination.send(bot.command_not_found.format(key))
return
@@ -564,7 +564,7 @@ class BotBase(GroupMixin):
self.remove_cog(cogname)
# first remove all the commands from the module
for command in self.commands.copy().values():
for command in self.all_commands.copy().values():
if command.module is lib:
command.module = None
if isinstance(command, GroupMixin):
@@ -676,7 +676,7 @@ class BotBase(GroupMixin):
invoker = view.get_word()
ctx.invoked_with = invoker
ctx.prefix = invoked_prefix
ctx.command = self.commands.get(invoker)
ctx.command = self.all_commands.get(invoker)
return ctx
@asyncio.coroutine