Skip to content

Option ABCs#

Option module-attribute #

Option = Annotated

Alias for typing.Annotated.

Example
arc.Option[type, arc.TypeParams(...)]

So for example, to create an int option, you would do:

arc.Option[int, arc.IntParams(...)]

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 instance-attribute #

description: str

The description of the option.

description_localizations class-attribute instance-attribute #

description_localizations: Mapping[Locale, str] = field(factory=dict)

The description of the option in different locales.

is_required class-attribute instance-attribute #

is_required: bool = True

Whether the option is required.

name instance-attribute #

name: str

The name of the option.

name_localizations class-attribute instance-attribute #

name_localizations: Mapping[Locale, str] = field(factory=dict)

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 instance-attribute #

description: str

The description of the option.

description_localizations class-attribute instance-attribute #

description_localizations: Mapping[Locale, str] = field(factory=dict)

The description of the option in different locales.

is_required class-attribute instance-attribute #

is_required: bool = True

Whether the option is required.

name instance-attribute #

name: str

The name of the option.

name_localizations class-attribute instance-attribute #

name_localizations: Mapping[Locale, str] = field(factory=dict)

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 #

Bases: ABC, Generic[T]

An abstract base class for all slash options and subcommands.

description instance-attribute #

description: str

The description of the option.

description_localizations class-attribute instance-attribute #

description_localizations: Mapping[Locale, str] = field(factory=dict)

The description of the option in different locales.

name instance-attribute #

name: str

The name of the option.

name_localizations class-attribute instance-attribute #

name_localizations: Mapping[Locale, str] = field(factory=dict)

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: str DEFAULT: None

description

The description of the option

TYPE: str DEFAULT: 'No description provided.'

name_localizations

The name of the option in different locales

TYPE: Mapping[Locale, str] DEFAULT: None

description_localizations

The description of the option in different locales

TYPE: Mapping[Locale, str] DEFAULT: None

description property #

description: str

The description of the option.

description_localizations property #

description_localizations: Mapping[Locale, str]

The description of the option in different locales.

name property #

name: str | None

The name of the option.

name_localizations property #

name_localizations: Mapping[Locale, str]

The name 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 #

ATTACHMENT = 11

Denotes a command option where the value will be an attachment.

BOOLEAN class-attribute instance-attribute #

BOOLEAN = 5

Denotes a command option where the value will be a bool.

CHANNEL class-attribute instance-attribute #

CHANNEL = 7

Denotes a command option where the value will be resolved to a channel.

COLOR class-attribute instance-attribute #

COLOR = 10002

Denotes a command option where the value will be a color.

EMOJI class-attribute instance-attribute #

EMOJI = 10003

Denotes a command option where the value will be an emoji.

FLOAT class-attribute instance-attribute #

FLOAT = 10

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 #

INTEGER = 4

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 #

MEMBER = 10001

Denotes a command option where the value will be resolved to a member.

MENTIONABLE class-attribute instance-attribute #

MENTIONABLE = 9

Denotes a command option where the value will be a snowflake ID.

ROLE class-attribute instance-attribute #

ROLE = 8

Denotes a command option where the value will be resolved to a role.

STRING class-attribute instance-attribute #

STRING = 3

Denotes a command option where the value will be a string.

SUB_COMMAND class-attribute instance-attribute #

SUB_COMMAND = 1

Denotes a command option where the value will be a sub command.

SUB_COMMAND_GROUP class-attribute instance-attribute #

SUB_COMMAND_GROUP = 2

Denotes a command option where the value will be a sub command group.

USER class-attribute instance-attribute #

USER = 6

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.

to_hikari #

to_hikari() -> OptionType

Convert an OptionType to a hikari.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 #

autocomplete_with: AutocompleteCallbackT[ClientT, ChoiceT] | None = None

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 instance-attribute #

description: str

The description of the option.

description_localizations class-attribute instance-attribute #

description_localizations: Mapping[Locale, str] = field(factory=dict)

The description of the option in different locales.

is_required class-attribute instance-attribute #

is_required: bool = True

Whether the option is required.

name instance-attribute #

name: str

The name of the option.

name_localizations class-attribute instance-attribute #

name_localizations: Mapping[Locale, str] = field(factory=dict)

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: str DEFAULT: None

description

The description of the option

TYPE: str DEFAULT: 'No description provided.'

name_localizations

The name of the option in different locales

TYPE: Mapping[Locale, str] DEFAULT: None

description_localizations

The description of the option in different locales

TYPE: Mapping[Locale, str] DEFAULT: None

choices

The choices for the option. If provided, these will be the only valid values for the option.

TYPE: Sequence[ChoiceT | CommandChoice] | Mapping[str, ChoiceT] | None DEFAULT: None

autocomplete_with

The callback for autocompleting the option.

TYPE: AutocompleteCallbackT[ClientT, ChoiceT] | None DEFAULT: None

autocomplete_with property #

autocomplete_with: AutocompleteCallbackT[ClientT, ChoiceT] | None

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 property #

description: str

The description of the option.

description_localizations property #

description_localizations: Mapping[Locale, str]

The description of the option in different locales.

name property #

name: str | None

The name of the option.

name_localizations property #

name_localizations: Mapping[Locale, str]

The name of the option in different locales.