diff --git a/discord/commands/core.py b/discord/commands/core.py index e48db22904..fcaf3bc13d 100644 --- a/discord/commands/core.py +++ b/discord/commands/core.py @@ -317,6 +317,10 @@ async def can_run(self, ctx: ApplicationContext) -> bool: raise CheckFailure(f"The global check functions for command {self.name} failed.") predicates = self.checks + if self.parent is not None: + # parent checks should be ran first + predicates = self.parent.checks + predicates + if not predicates: # since we have no checks, then we just return True. return True @@ -898,7 +902,7 @@ def __init__( self.subcommands: List[Union[SlashCommand, SlashCommandGroup]] = self.__initial_commands__ self.guild_ids = guild_ids self.parent = parent - self.checks = [] + self.checks = kwargs.get("checks", []) self._before_invoke = None self._after_invoke = None