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.
type
class-attribute
instance-attribute
#
type: Union[ComponentType, int] = field()
The type of component this is.
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
#
A red button (usually indicates a destructive action).
LINK
class-attribute
instance-attribute
#
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.
channel_types
class-attribute
instance-attribute
#
channel_types: Sequence[Union[int, ChannelType]] = field(eq=False)
The valid channel types for this menu.
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
.
placeholder
class-attribute
instance-attribute
#
Custom placeholder text shown if nothing is selected, max 100 characters.
type
class-attribute
instance-attribute
#
type: Union[ComponentType, int] = field()
The type of component this is.
ComponentType
#
Bases: int
, Enum
Types of components found within Discord.
ACTION_ROW
class-attribute
instance-attribute
#
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
#
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
#
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
#
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
#
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
#
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
#
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
#
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
.
placeholder
class-attribute
instance-attribute
#
Custom placeholder text shown if nothing is selected, max 100 characters.
type
class-attribute
instance-attribute
#
type: Union[ComponentType, int] = field()
The type of component this is.
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.
TextSelectMenuComponent
#
Bases: SelectMenuComponent
Represents a text 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
.
options
class-attribute
instance-attribute
#
options: Sequence[SelectMenuOption] = field(eq=False)
Sequence of up to 25 of the options set for this menu.
placeholder
class-attribute
instance-attribute
#
Custom placeholder text shown if nothing is selected, max 100 characters.
type
class-attribute
instance-attribute
#
type: Union[ComponentType, int] = field()
The type of component this is.