hikari.components#

Application and entities that are used to describe components on Discord.

Module Contents#

class hikari.components.ActionRowComponent[source]#

Bases: Generic[AllowedComponentsT], PartialComponent

Represents a row of components.

components: Sequence[AllowedComponentsT][source]#

Sequence of the components contained within this row.

class hikari.components.ButtonComponent[source]#

Bases: PartialComponent

Represents a button component.

custom_id: str | None[source]#

Developer defined identifier for this button (will be <= 100 characters).

Note

This is required for the following button styles:

emoji: hikari.emojis.Emoji | None[source]#

Custom or unicode emoji which appears on the button.

is_disabled: bool[source]#

Whether the button is disabled.

label: str | None[source]#

Text label which appears on the button.

style: ButtonStyle | int[source]#

The button’s style.

url: str | None[source]#

Url for ButtonStyle.LINK style buttons.

class hikari.components.ButtonStyle[source]#

Bases: int, hikari.internal.enums.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 = 4[source]#

A red button (usually indicates a destructive action).

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.

PRIMARY = 1[source]#

A blurple “call to action” button.

SECONDARY = 2[source]#

A grey neutral button.

SUCCESS = 3[source]#

A green button.

class hikari.components.ChannelSelectMenuComponent[source]#

Bases: SelectMenuComponent

Represents a channel select menu component.

channel_types: Sequence[int | hikari.channels.ChannelType][source]#

The valid channel types for this menu.

class hikari.components.ComponentType[source]#

Bases: int, hikari.internal.enums.Enum

Types of components found within Discord.

ACTION_ROW = 1[source]#

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 = 2[source]#

A button component.

Note

This cannot be top-level and must be within a container component such as ComponentType.ACTION_ROW.

CHANNEL_SELECT_MENU = 8[source]#

A channel select component.

Note

This cannot be top-level and must be within a container component such as ComponentType.ACTION_ROW.

MENTIONABLE_SELECT_MENU = 7[source]#

A mentionable (users and roles) select component.

Note

This cannot be top-level and must be within a container component such as ComponentType.ACTION_ROW.

ROLE_SELECT_MENU = 6[source]#

A role select component.

Note

This cannot be top-level and must be within a container component such as ComponentType.ACTION_ROW.

SELECT_MENU[source]#

Deprecated alias for TEXT_MENU_SELECT.

TEXT_INPUT = 4[source]#

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 ComponentType.ACTION_ROW.

TEXT_SELECT_MENU = 3[source]#

A text select component.

Note

This cannot be top-level and must be within a container component such as ComponentType.ACTION_ROW.

USER_SELECT_MENU = 5[source]#

A user select component.

Note

This cannot be top-level and must be within a container component such as ComponentType.ACTION_ROW.

class hikari.components.PartialComponent[source]#

Base class for all component entities.

type: ComponentType | int[source]#

The type of component this is.

class hikari.components.SelectMenuComponent[source]#

Bases: PartialComponent

Represents a select menu component.

custom_id: str[source]#

Developer defined identifier for this menu (will be <= 100 characters).

is_disabled: bool[source]#

Whether the select menu is disabled.

max_values: int[source]#

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 SelectMenuComponent.min_values.

min_values: int[source]#

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 SelectMenuComponent.max_values.

placeholder: str | None[source]#

Custom placeholder text shown if nothing is selected, max 100 characters.

class hikari.components.SelectMenuOption[source]#

Represents an option for a SelectMenuComponent.

description: str | None[source]#

Optional description of the option, max 100 characters.

emoji: hikari.emojis.Emoji | None[source]#

Custom or unicode emoji which appears on the button.

is_default: bool[source]#

Whether this option will be selected by default.

label: str[source]#

User-facing name of the option, max 100 characters.

value: str[source]#

Dev-defined value of the option, max 100 characters.

class hikari.components.TextInputComponent[source]#

Bases: PartialComponent

Represents a text input component.

custom_id: str[source]#

Developer set custom ID used for identifying interactions with this modal.

value: str[source]#

Value provided for this text input.

class hikari.components.TextInputStyle[source]#

Bases: int, hikari.internal.enums.Enum

A text input style.

PARAGRAPH = 2[source]#

Intended for much longer inputs.

SHORT = 1[source]#

Intended for short single-line text.

class hikari.components.TextSelectMenuComponent[source]#

Bases: SelectMenuComponent

Represents a text select menu component.

options: Sequence[SelectMenuOption][source]#

Sequence of up to 25 of the options set for this menu.

hikari.components.InteractiveButtonTypes: AbstractSet[InteractiveButtonTypesT][source]#

Set of the ButtonType which are valid for interactive buttons.

The following values are included in this:

hikari.components.InteractiveButtonTypesT[source]#

Type hints of the ButtonStyle values which are valid for interactive buttons.

The following values are valid for this:

hikari.components.MessageActionRowComponent[source]#

A message action row component.

hikari.components.MessageComponentTypesT[source]#

Type hint of the PartialComponent that be contained in a MessageActionRowComponent.

The following values are valid for this:

hikari.components.ModalActionRowComponent[source]#

A modal action row component.

hikari.components.ModalComponentTypesT[source]#

Type hint of the PartialComponent that be contained in a ModalActionRowComponent.

The following values are valid for this: