Option ABCs#
CommandOptionBase
#
Bases: OptionBase[T]
, Generic[T, ClientT, ParamsT]
An abstract base class for all slash command options. This does not include subcommands.
arg_name
instance-attribute
#
arg_name: str
The name of the parameter this option represents.
This is going to be the same as name
unless name
was overriden.
description_localizations
class-attribute
instance-attribute
#
The description of the option in different locales.
is_required
class-attribute
instance-attribute
#
is_required: bool = True
Whether the option is required.
name_localizations
class-attribute
instance-attribute
#
The name of the option in different locales.
option_type
abstractmethod
property
#
option_type: OptionType
The type of the option. Used to register the command.
to_command_option
#
to_command_option() -> CommandOption
Convert this option to a hikari.CommandOption.
ConverterOption
#
Bases: CommandOptionBase[T, ClientT, ParamsT]
, Generic[T, ClientT, ParamsT, OriginT]
An option with a built-in converter.
arg_name
instance-attribute
#
arg_name: str
The name of the parameter this option represents.
This is going to be the same as name
unless name
was overriden.
description_localizations
class-attribute
instance-attribute
#
The description of the option in different locales.
is_required
class-attribute
instance-attribute
#
is_required: bool = True
Whether the option is required.
name_localizations
class-attribute
instance-attribute
#
The name of the option in different locales.
option_type
abstractmethod
property
#
option_type: OptionType
The type of the option. Used to register the command.
to_command_option
#
to_command_option() -> CommandOption
Convert this option to a hikari.CommandOption.
OptionBase
#
An abstract base class for all slash options and subcommands.
description_localizations
class-attribute
instance-attribute
#
The description of the option in different locales.
name_localizations
class-attribute
instance-attribute
#
The name of the option in different locales.
option_type
abstractmethod
property
#
option_type: OptionType
The type of the option. Used to register the command.
to_command_option
#
to_command_option() -> CommandOption
Convert this option to a hikari.CommandOption.
OptionParams
#
OptionParams(
description: str = "No description provided.",
*,
name: str | None = None,
name_localizations: Mapping[Locale, str] | None = None,
description_localizations: Mapping[Locale, str] | None = None
)
Bases: Generic[T]
The base class for all option parameters objects.
PARAMETER | DESCRIPTION |
---|---|
name |
The name of the option
TYPE:
|
description |
The description of the option
TYPE:
|
name_localizations |
The name of the option in different locales |
description_localizations |
The description of the option in different locales |
description_localizations
property
#
The description of the option in different locales.
OptionType
#
Bases: IntEnum
The type of a command option.
This includes all hikari option types along with some custom ones.
Custom arc-specific options start with 10k.
ATTACHMENT
class-attribute
instance-attribute
#
Denotes a command option where the value will be an attachment.
BOOLEAN
class-attribute
instance-attribute
#
Denotes a command option where the value will be a bool.
CHANNEL
class-attribute
instance-attribute
#
Denotes a command option where the value will be resolved to a channel.
COLOR
class-attribute
instance-attribute
#
Denotes a command option where the value will be a color.
EMOJI
class-attribute
instance-attribute
#
Denotes a command option where the value will be an emoji.
FLOAT
class-attribute
instance-attribute
#
Denotes a command option where the value will be a float.
This is range limited between -2^53 and 2^53.
INTEGER
class-attribute
instance-attribute
#
Denotes a command option where the value will be a int.
This is range limited between -2^53 and 2^53.
MEMBER
class-attribute
instance-attribute
#
Denotes a command option where the value will be resolved to a member.
MENTIONABLE
class-attribute
instance-attribute
#
Denotes a command option where the value will be a snowflake ID.
ROLE
class-attribute
instance-attribute
#
Denotes a command option where the value will be resolved to a role.
STRING
class-attribute
instance-attribute
#
Denotes a command option where the value will be a string.
SUB_COMMAND
class-attribute
instance-attribute
#
Denotes a command option where the value will be a sub command.
SUB_COMMAND_GROUP
class-attribute
instance-attribute
#
Denotes a command option where the value will be a sub command group.
USER
class-attribute
instance-attribute
#
Denotes a command option where the value will be resolved to a user.
from_hikari
classmethod
#
from_hikari(option_type: OptionType) -> OptionType
Convert a hikari.OptionType to an OptionType.
OptionWithChoices
#
Bases: CommandOptionBase[ChoiceT, ClientT, ParamsT]
An option that can have choices or be autocompleted.
arg_name
instance-attribute
#
arg_name: str
The name of the parameter this option represents.
This is going to be the same as name
unless name
was overriden.
autocomplete_with
class-attribute
instance-attribute
#
The callback for autocompleting the option.
choices
class-attribute
instance-attribute
#
choices: Sequence[ChoiceT | CommandChoice] | Mapping[str, ChoiceT] | None = None
The choices for the option.
description_localizations
class-attribute
instance-attribute
#
The description of the option in different locales.
is_required
class-attribute
instance-attribute
#
is_required: bool = True
Whether the option is required.
name_localizations
class-attribute
instance-attribute
#
The name of the option in different locales.
option_type
abstractmethod
property
#
option_type: OptionType
The type of the option. Used to register the command.
to_command_option
#
to_command_option() -> CommandOption
Convert this option to a hikari.CommandOption.
OptionWithChoicesParams
#
OptionWithChoicesParams(
description: str = "No description provided.",
*,
name: str | None = None,
name_localizations: Mapping[Locale, str] | None = None,
description_localizations: Mapping[Locale, str] | None = None,
choices: (
Sequence[ChoiceT | CommandChoice] | Mapping[str, ChoiceT] | None
) = None,
autocomplete_with: AutocompleteCallbackT[ClientT, ChoiceT] | None = None
)
Bases: OptionParams[ChoiceT]
, Generic[ChoiceT, ClientT]
The parameters for an option that can have choices or be autocompleted.
Warning
You cannot provide both choices
and autocomplete_with
at the same time.
PARAMETER | DESCRIPTION |
---|---|
name |
The name of the option
TYPE:
|
description |
The description of the option
TYPE:
|
name_localizations |
The name of the option in different locales |
description_localizations |
The description of the option in different locales |
choices |
The choices for the option. If provided, these will be the only valid values for the option.
TYPE:
|
autocomplete_with |
The callback for autocompleting the option.
TYPE:
|
autocomplete_with
property
#
The callback for autocompleting the option.
choices
property
#
choices: Sequence[ChoiceT | CommandChoice] | Mapping[str, ChoiceT] | None
The choices for the option. If provided, these will be the only valid values for the option.
description_localizations
property
#
The description of the option in different locales.