Skip to content

Sub command

SubCommand #

sub_command #
sub_command(name: str | None = None, description: LocalizedOr[str] = 'No description', *, display_name: LocalizedOr[str] | None = None, options: Sequence[Option] = (), hooks: Sequence[Hook] = ()) -> Callable[[CommandCallbackT], None]

Decorator for the sub-command.

This object can only be created by using the decorator @sub_command on a function in a class that inherits from SlashCommand.

Parameters:

  • name (str, default: None ) –

    The unique name for the sub-command.

  • description (LocalizedOr[str] | None, default: 'No description' ) –

    Optional description for the sub-command.

  • display_name (LocalizedOr[str] | None, default: None ) –

    A display name of command. Can be localized.

  • options (Sequence[Option], default: () ) –

    Optional options of the sub-command.

Note

The callback must be asynchronous.