6868if TYPE_CHECKING :
6969 from .member import Member
7070
71+ C = TypeVar ("C" , bound = MessageCommand | SlashCommand | UserCommand )
7172CoroFunc = Callable [..., Coroutine [Any , Any , Any ]]
7273CFT = TypeVar ("CFT" , bound = CoroFunc )
7374
@@ -909,65 +910,74 @@ async def callback() -> None:
909910 autocomplete_task .cancel ()
910911
911912 def slash_command (self , ** kwargs ):
912- """A shortcut decorator that invokes :func:`command` and adds it to
913- the internal command list via :meth:`add_application_command`.
914- This shortcut is made specifically for :class:`. SlashCommand`.
913+ """A shortcut decorator for adding a slash command to the bot.
914+ This is equivalent to using :meth:`application_command`, providing
915+ the :class:`SlashCommand` class .
915916
916917 .. versionadded:: 2.0
917918
918919 Returns
919920 -------
920921 Callable[..., :class:`SlashCommand`]
921- A decorator that converts the provided method into a :class:`.SlashCommand`, adds it to the bot ,
922- then returns it.
922+ A decorator that converts the provided function into a :class:`.SlashCommand`,
923+ adds it to the bot, and returns it.
923924 """
924925 return self .application_command (cls = SlashCommand , ** kwargs )
925926
926927 def user_command (self , ** kwargs ):
927- """A shortcut decorator that invokes :func:`command` and adds it to
928- the internal command list via :meth:`add_application_command`.
929- This shortcut is made specifically for :class:`. UserCommand`.
928+ """A shortcut decorator for adding a user command to the bot.
929+ This is equivalent to using :meth:`application_command`, providing
930+ the :class:`UserCommand` class .
930931
931932 .. versionadded:: 2.0
932933
933934 Returns
934935 -------
935936 Callable[..., :class:`UserCommand`]
936- A decorator that converts the provided method into a :class:`.UserCommand`, adds it to the bot ,
937- then returns it.
937+ A decorator that converts the provided function into a :class:`.UserCommand`,
938+ adds it to the bot, and returns it.
938939 """
939940 return self .application_command (cls = UserCommand , ** kwargs )
940941
941942 def message_command (self , ** kwargs ):
942- """A shortcut decorator that invokes :func:`command` and adds it to
943- the internal command list via :meth:`add_application_command`.
944- This shortcut is made specifically for :class:`. MessageCommand`.
943+ """A shortcut decorator for adding a message command to the bot.
944+ This is equivalent to using :meth:`application_command`, providing
945+ the :class:`MessageCommand` class .
945946
946947 .. versionadded:: 2.0
947948
948949 Returns
949950 -------
950951 Callable[..., :class:`MessageCommand`]
951- A decorator that converts the provided method into a :class:`.MessageCommand`, adds it to the bot ,
952- then returns it.
952+ A decorator that converts the provided function into a :class:`.MessageCommand`,
953+ adds it to the bot, and returns it.
953954 """
954955 return self .application_command (cls = MessageCommand , ** kwargs )
955956
956- def application_command (self , ** kwargs ):
957- """A shortcut decorator that invokes :func:`command` and adds it to
957+ def application_command (self , cls : type [C ] = SlashCommand , ** kwargs ):
958+ """A shortcut decorator that converts the provided function into
959+ an application command via :func:`command` and adds it to
958960 the internal command list via :meth:`~.Bot.add_application_command`.
959961
960962 .. versionadded:: 2.0
961963
964+ Parameters
965+ ----------
966+ cls: Type[:class:`ApplicationCommand`]
967+ The factory class that will be used to create the command.
968+ By default, this is :class:`.SlashCommand`. Should a custom
969+ class be provided, it must be a subclass of either
970+ :class:`SlashCommand`, :class:`MessageCommand` or :class:`UserCommand`.
971+
962972 Returns
963973 -------
964974 Callable[..., :class:`ApplicationCommand`]
965- A decorator that converts the provided method into an :class:`.ApplicationCommand`, adds it to the bot ,
966- then returns it.
975+ A decorator that converts the provided function into an :class:`.ApplicationCommand`,
976+ adds it to the bot, and returns it.
967977 """
968978
969- def decorator (func ) -> ApplicationCommand :
970- result = command (** kwargs )(func )
979+ def decorator (func ) -> C :
980+ result = command (cls = cls , ** kwargs )(func )
971981 self .add_application_command (result )
972982 return result
973983
@@ -985,8 +995,8 @@ def command(self, **kwargs):
985995 Returns
986996 -------
987997 Callable[..., :class:`ApplicationCommand`]
988- A decorator that converts the provided method into an :class:`.ApplicationCommand`, adds it to the bot ,
989- then returns it.
998+ A decorator that converts the provided function into an :class:`.ApplicationCommand`,
999+ adds it to the bot, and returns it.
9901000 """
9911001 return self .application_command (** kwargs )
9921002
0 commit comments