@@ -346,13 +346,6 @@ class PrefixedCommand(BaseCommand):
346346 ),
347347 default = True ,
348348 )
349- hierarchical_checking : bool = attrs .field (
350- metadata = docs (
351- "If `True` and if the base of a subcommand, every subcommand underneath it will run this command's checks"
352- " and cooldowns before its own. Otherwise, only the subcommand's checks are checked."
353- ),
354- default = True ,
355- )
356349 help : Optional [str ] = attrs .field (repr = False , metadata = docs ("The long help text for the command." ), default = None )
357350 brief : Optional [str ] = attrs .field (repr = False , metadata = docs ("The short help text for the command." ), default = None )
358351 parent : Optional ["PrefixedCommand" ] = attrs .field (
@@ -638,7 +631,7 @@ def subcommand(
638631 enabled : bool = True ,
639632 hidden : bool = False ,
640633 ignore_extra : bool = True ,
641- hierarchical_checking : bool = True ,
634+ inherit_checks : bool = True ,
642635 ) -> Callable [..., Self ]:
643636 """
644637 A decorator to declare a subcommand for a prefixed command.
@@ -654,8 +647,7 @@ def subcommand(
654647 hidden: If `True`, the default help command (when it is added) does not show this in the help output.
655648 ignore_extra: If `True`, ignores extraneous strings passed to a command if all its requirements are met \
656649 (e.g. ?foo a b c when only expecting a and b). Otherwise, an error is raised.
657- hierarchical_checking: If `True` and if the base of a subcommand, every subcommand underneath it will \
658- run this command's checks before its own. Otherwise, only the subcommand's checks are checked.
650+ inherit_checks: If `True`, the subcommand will inherit its checks from the parent command.
659651 """
660652
661653 def wrapper (func : Callable ) -> Self :
@@ -670,7 +662,7 @@ def wrapper(func: Callable) -> Self:
670662 enabled = enabled ,
671663 hidden = hidden ,
672664 ignore_extra = ignore_extra ,
673- hierarchical_checking = hierarchical_checking ,
665+ checks = self . checks if inherit_checks else [] ,
674666 )
675667 self .add_command (cmd )
676668 return cmd
@@ -776,7 +768,6 @@ def prefixed_command(
776768 enabled : bool = True ,
777769 hidden : bool = False ,
778770 ignore_extra : bool = True ,
779- hierarchical_checking : bool = True ,
780771) -> Callable [..., PrefixedCommand ]:
781772 """
782773 A decorator to declare a coroutine as a prefixed command.
@@ -792,8 +783,6 @@ def prefixed_command(
792783 hidden: If `True`, the default help command (when it is added) does not show this in the help output.
793784 ignore_extra: If `True`, ignores extraneous strings passed to a command if all its requirements are \
794785 met (e.g. ?foo a b c when only expecting a and b). Otherwise, an error is raised.
795- hierarchical_checking: If `True` and if the base of a subcommand, every subcommand underneath it will \
796- run this command's checks before its own. Otherwise, only the subcommand's checks are checked.
797786 """
798787
799788 def wrapper (func : Callable ) -> PrefixedCommand :
@@ -807,7 +796,6 @@ def wrapper(func: Callable) -> PrefixedCommand:
807796 enabled = enabled ,
808797 hidden = hidden ,
809798 ignore_extra = ignore_extra ,
810- hierarchical_checking = hierarchical_checking ,
811799 )
812800
813801 return wrapper
0 commit comments