[commands] Explicitly assign invoked_subcommand to None before invoking

This should fix instances of it not working as expected in nested
groups.
This commit is contained in:
Rapptz 2019-05-11 18:17:57 -04:00
parent 26a6970882
commit f74d73327b

View File

@ -1132,6 +1132,7 @@ class Group(GroupMixin, Command):
return ret
async def invoke(self, ctx):
ctx.invoked_subcommand = None
early_invoke = not self.invoke_without_command
if early_invoke:
await self.prepare(ctx)
@ -1159,6 +1160,7 @@ class Group(GroupMixin, Command):
await super().invoke(ctx)
async def reinvoke(self, ctx, *, call_hooks=False):
ctx.invoked_subcommand = None
early_invoke = not self.invoke_without_command
if early_invoke:
ctx.command = self