Components¶
This section documents everything related to message components - Discord feature which allows bot developers to create their own component-based UIs right inside Discord.
Warning
Classes listed below are not meant to be created by user and are only recieved from the API. For constructible version see Bot UI Kit.
Discord Models¶
Component¶
- class disnake.Component[source]¶
This class is a Discord Model.
Represents a Discord Bot UI Kit Component.
Currently, the only components supported by Discord are:
subtypes of
BaseSelectMenu(SelectMenu)
This class is abstract and cannot be instantiated.
New in version 2.0.
- type¶
The type of component.
- Type:
ActionRow¶
- class disnake.ActionRow[source]¶
This class is a Discord Model.
Represents an action row.
This is a component that holds up to 5 children components in a row.
This inherits from
Component.New in version 2.0.
- type¶
The type of component.
- Type:
- children¶
The children components that this holds, if any.
- Type:
List[Union[
Button,BaseSelectMenu,TextInput]]
SelectOption¶
- class disnake.SelectOption(*, label, value=..., description=None, emoji=None, default=False)[source]¶
Represents a string select menu’s option.
These can be created by users.
New in version 2.0.
- label¶
The label of the option. This is displayed to users. Can only be up to 100 characters.
- Type:
- value¶
The value of the option. This is not displayed to users. If not provided when constructed then it defaults to the label. Can only be up to 100 characters.
- Type:
- description¶
An additional description of the option, if any. Can only be up to 100 characters.
- Type:
Optional[
str]
- emoji¶
The emoji of the option, if available.
- Type:
Optional[Union[
str,Emoji,PartialEmoji]]
TextInput¶
- class disnake.TextInput[source]¶
This class is a Discord Model.
Represents a text input from the Discord Bot UI Kit.
New in version 2.4.
Note
The user constructible and usable type to create a text input is
disnake.ui.TextInput, not this one.- style¶
The style of the text input.
- Type:
Enumerations¶
ComponentType¶
- class disnake.ComponentType[source]¶
This class is an Enumeration.
Represents the component type of a component.
New in version 2.0.
- action_row¶
Represents the group component which holds different components in a row.
- button¶
Represents a button component.
- select¶
Represents a select component.
- text_input¶
Represents a text input component.
TextInputStyle¶
- class disnake.TextInputStyle[source]¶
This class is an Enumeration.
Represents a style of the text input component.
New in version 2.4.
- short¶
Represents a single-line text input component.
- paragraph¶
Represents a multi-line text input component.