@@ -612,6 +612,33 @@ def decor(func):
612
612
return decor
613
613
614
614
class SlashCommandGroup (ApplicationCommand , Option ):
615
+ r"""A class that implements the protocol for a slash command group.
616
+
617
+ These can be created manually, but they should be created via the
618
+ decorator or functional interface.
619
+
620
+ Attributes
621
+ -----------
622
+ name: :class:`str`
623
+ The name of the command.
624
+ description: Optional[:class:`str`]
625
+ The description for the command.
626
+ guild_ids: Optional[List[:class:`int`]]
627
+ The ids of the guilds where this command will be registered.
628
+ parent_group: Optional[:class:`SlashCommandGroup`]
629
+ The parent group of this group.
630
+ subcommands: List[Union[:class:`SlashCommand`, :class:`SlashCommandGroup`]]
631
+ The list of all subcommands under this group.
632
+ cog: Optional[:class:`Cog`]
633
+ The cog that this command belongs to. ``None`` if there isn't one.
634
+ checks: List[Callable[[:class:`.ApplicationContext`], :class:`bool`]]
635
+ A list of predicates that verifies if the command could be executed
636
+ with the given :class:`.ApplicationContext` as the sole parameter. If an exception
637
+ is necessary to be thrown to signal failure, then one inherited from
638
+ :exc:`.CommandError` should be used. Note that if the checks fail then
639
+ :exc:`.CheckFailure` exception is raised to the :func:`.on_application_command_error`
640
+ event.
641
+ """
615
642
type = 1
616
643
617
644
def __new__ (cls , * args , ** kwargs ) -> SlashCommandGroup :
@@ -680,6 +707,29 @@ async def _invoke(self, ctx: ApplicationContext) -> None:
680
707
await command .invoke (ctx )
681
708
682
709
class ContextMenuCommand (ApplicationCommand ):
710
+ r"""A class that implements the protocol for context menu commands.
711
+
712
+ These are not created manually, instead they are created via the
713
+ decorator or functional interface.
714
+
715
+ Attributes
716
+ -----------
717
+ name: :class:`str`
718
+ The name of the command.
719
+ callback: :ref:`coroutine <coroutine>`
720
+ The coroutine that is executed when the command is called.
721
+ guild_ids: Optional[List[:class:`int`]]
722
+ The ids of the guilds where this command will be registered.
723
+ cog: Optional[:class:`Cog`]
724
+ The cog that this command belongs to. ``None`` if there isn't one.
725
+ checks: List[Callable[[:class:`.ApplicationContext`], :class:`bool`]]
726
+ A list of predicates that verifies if the command could be executed
727
+ with the given :class:`.ApplicationContext` as the sole parameter. If an exception
728
+ is necessary to be thrown to signal failure, then one inherited from
729
+ :exc:`.CommandError` should be used. Note that if the checks fail then
730
+ :exc:`.CheckFailure` exception is raised to the :func:`.on_application_command_error`
731
+ event.
732
+ """
683
733
def __new__ (cls , * args , ** kwargs ) -> ContextMenuCommand :
684
734
self = super ().__new__ (cls )
685
735
@@ -693,7 +743,7 @@ def __init__(self, func: Callable, *args, **kwargs) -> None:
693
743
694
744
self .guild_ids : Optional [List [int ]] = kwargs .get ("guild_ids" , None )
695
745
696
- # Discord API doesn't support setting descriptions for User commands
746
+ # Discord API doesn't support setting descriptions for context menu commands
697
747
# so it must be empty
698
748
self .description = ""
699
749
self .name : str = kwargs .pop ("name" , func .__name__ )
0 commit comments