From d4e982faeaf3aa58674e775e10b50a3b78626ec5 Mon Sep 17 00:00:00 2001 From: Michael H Date: Thu, 27 Feb 2020 19:40:28 -0500 Subject: [PATCH] Fix Red specific behavior of invoke_without_command (#3614) --- redbot/core/commands/commands.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/redbot/core/commands/commands.py b/redbot/core/commands/commands.py index dd1c7c1c9..4b52b1e66 100644 --- a/redbot/core/commands/commands.py +++ b/redbot/core/commands/commands.py @@ -418,7 +418,6 @@ class Command(CogCommandMixin, DPYCommand): Whether or not the permission state should be changed as a result of this call. For most cases this should be ``False``. Defaults to ``False``. - """ ret = await super().can_run(ctx) if ret is False: @@ -785,14 +784,16 @@ class Group(GroupMixin, Command, CogGroupMixin, DPYGroup): if ctx.invoked_subcommand is None or self == ctx.invoked_subcommand: if self.autohelp and not self.invoke_without_command: - await self.can_run(ctx, change_permission_state=True) + if not await self.can_run(ctx, change_permission_state=True): + raise CheckFailure() await ctx.send_help() elif self.invoke_without_command: # So invoke_without_command when a subcommand of this group is invoked # will skip the the invokation of *this* command. However, because of # how our permissions system works, we don't want it to skip the checks # as well. - await self.can_run(ctx, change_permission_state=True) + if not await self.can_run(ctx, change_permission_state=True): + raise CheckFailure() # this is actually why we don't prepare earlier. await super().invoke(ctx)