hikari.components
#
Application and entities that are used to describe components on Discord.
InteractiveButtonTypes module-attribute
#
InteractiveButtonTypes: AbstractSet[InteractiveButtonTypesT] = frozenset([PRIMARY, SECONDARY, SUCCESS, DANGER])
Set of the hikari.components.ButtonStyle
which are valid for interactive buttons.
The following values are included in this:
InteractiveButtonTypesT module-attribute
#
InteractiveButtonTypesT = Union[Literal[PRIMARY], Literal[1], Literal[SECONDARY], Literal[2], Literal[SUCCESS], Literal[3], Literal[DANGER], Literal[4]]
Type hints of the hikari.components.ButtonStyle
values which are valid for interactive buttons.
The following values are valid for this:
MessageActionRowComponent module-attribute
#
MessageActionRowComponent = ActionRowComponent[MessageComponentTypesT]
A message action row component.
MessageComponentTypesT module-attribute
#
MessageComponentTypesT = Union[ButtonComponent, SelectMenuComponent]
Type hint of the hikari.components.PartialComponent
that be contained in a hikari.components.PartialComponent
.
The following values are valid for this:
ModalActionRowComponent module-attribute
#
ModalActionRowComponent = ActionRowComponent[ModalComponentTypesT]
A modal action row component.
ModalComponentTypesT module-attribute
#
ModalComponentTypesT = TextInputComponent
Type hint of the hikari.components.PartialComponent
that be contained in a hikari.components.PartialComponent
.
The following values are valid for this:
SelectMenuTypes module-attribute
#
SelectMenuTypes: AbstractSet[SelectMenuTypesT] = frozenset((TEXT_SELECT_MENU, USER_SELECT_MENU, ROLE_SELECT_MENU, MENTIONABLE_SELECT_MENU, CHANNEL_SELECT_MENU))
Set of the hikari.components.ComponentType
values which are valid for select menus.
The following values are included in this:
SelectMenuTypesT module-attribute
#
SelectMenuTypesT = Union[Literal[TEXT_SELECT_MENU], Literal[3], Literal[USER_SELECT_MENU], Literal[5], Literal[ROLE_SELECT_MENU], Literal[6], Literal[MENTIONABLE_SELECT_MENU], Literal[7], Literal[CHANNEL_SELECT_MENU], Literal[8]]
Type hints of the hikari.components.ComponentType
values which are valid for select menus.
The following values are valid for this:
ActionRowComponent #
Bases: Generic[AllowedComponentsT]
, PartialComponent
Represents a row of components.
ButtonComponent #
Bases: PartialComponent
Represents a button component.
custom_id class-attribute
instance-attribute
#
Developer defined identifier for this button (will be <= 100 characters).
Note
This is required for the following button styles:
emoji class-attribute
instance-attribute
#
Custom or unicode emoji which appears on the button.
is_disabled class-attribute
instance-attribute
#
Whether the button is disabled.
label class-attribute
instance-attribute
#
Text label which appears on the button.
style class-attribute
instance-attribute
#
style: Union[ButtonStyle, int] = field(eq=False)
The button's style.
url class-attribute
instance-attribute
#
Url for hikari.components.ButtonStyle.LINK
style buttons.
ButtonStyle #
Bases: int
, Enum
Enum of the available button styles.
More information, such as how these look, can be found at https://discord.com/developers/docs/interactions/message-components#button-object-button-styles
DANGER class-attribute
instance-attribute
#
DANGER = 4
A red button (usually indicates a destructive action).
LINK class-attribute
instance-attribute
#
LINK = 5
A grey button which navigates to a URL.
Warning
Unlike the other button styles, clicking this one will not trigger an interaction and custom_id shouldn't be included for this style.
ChannelSelectMenuComponent #
Bases: SelectMenuComponent
Represents a channel select menu component.
ComponentType #
Bases: int
, Enum
Types of components found within Discord.
ACTION_ROW class-attribute
instance-attribute
#
ACTION_ROW = 1
A non-interactive container component for other types of components.
Note
As this is a container component it can never be contained within another component and therefore will always be top-level.
Note
As of writing this can only contain one component type.
BUTTON class-attribute
instance-attribute
#
BUTTON = 2
A button component.
Note
This cannot be top-level and must be within a container component such as hikari.components.ComponentType.ACTION_ROW
.
CHANNEL_SELECT_MENU class-attribute
instance-attribute
#
CHANNEL_SELECT_MENU = 8
A channel select component.
Note
This cannot be top-level and must be within a container component such as hikari.components.ComponentType.ACTION_ROW
.
MENTIONABLE_SELECT_MENU class-attribute
instance-attribute
#
MENTIONABLE_SELECT_MENU = 7
A mentionable (users and roles) select component.
Note
This cannot be top-level and must be within a container component such as hikari.components.ComponentType.ACTION_ROW
.
ROLE_SELECT_MENU class-attribute
instance-attribute
#
ROLE_SELECT_MENU = 6
A role select component.
Note
This cannot be top-level and must be within a container component such as hikari.components.ComponentType.ACTION_ROW
.
TEXT_INPUT class-attribute
instance-attribute
#
TEXT_INPUT = 4
A text input component.
Note
This component may only be used inside a modal container.
Note
This cannot be top-level and must be within a container component such as hikari.components.ComponentType.ACTION_ROW
.
TEXT_SELECT_MENU class-attribute
instance-attribute
#
TEXT_SELECT_MENU = 3
A text select component.
Note
This cannot be top-level and must be within a container component such as hikari.components.ComponentType.ACTION_ROW
.
USER_SELECT_MENU class-attribute
instance-attribute
#
USER_SELECT_MENU = 5
A user select component.
Note
This cannot be top-level and must be within a container component such as hikari.components.ComponentType.ACTION_ROW
.
PartialComponent #
Base class for all component entities.
type class-attribute
instance-attribute
#
type: Union[ComponentType, int] = field()
The type of component this is.
SelectMenuComponent #
Bases: PartialComponent
Represents a select menu component.
custom_id class-attribute
instance-attribute
#
Developer defined identifier for this menu (will be <= 100 characters).
is_disabled class-attribute
instance-attribute
#
Whether the select menu is disabled.
max_values class-attribute
instance-attribute
#
The minimum amount of options which can be chosen for this menu.
This will be less than or equal to 25 and will be greater than or equal to hikari.components.SelectMenuComponent.min_values
.
min_values class-attribute
instance-attribute
#
The minimum amount of options which must be chosen for this menu.
This will be greater than or equal to 0 and will be less than or equal to hikari.components.SelectMenuComponent.max_values
.
SelectMenuOption #
Represents an option for a hikari.components.SelectMenuComponent
.
description class-attribute
instance-attribute
#
Optional description of the option, max 100 characters.
emoji class-attribute
instance-attribute
#
Custom or unicode emoji which appears on the button.
is_default class-attribute
instance-attribute
#
Whether this option will be selected by default.
label class-attribute
instance-attribute
#
User-facing name of the option, max 100 characters.
TextInputComponent #
Bases: PartialComponent
Represents a text input component.
TextInputStyle #
TextSelectMenuComponent #
Bases: SelectMenuComponent
Represents a text select menu component.
options class-attribute
instance-attribute
#
options: Sequence[SelectMenuOption] = field(eq=False)
Sequence of up to 25 of the options set for this menu.