Components¶
This section documents everything related to message components — a 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 versions, see Bot UI Kit.
Discord Models¶
Component¶
- class disnake.Component[source]¶
Represents a Discord Bot UI Kit Component.
Currently, the only components supported by Discord are:
subtypes of
BaseSelectMenu
(ChannelSelectMenu
,MentionableSelectMenu
,RoleSelectMenu
,StringSelectMenu
,UserSelectMenu
)
This class is abstract and cannot be instantiated.
New in version 2.0.
- type¶
The type of component.
- Type:
ActionRow¶
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
]]
SelectDefaultValue¶
- class disnake.SelectDefaultValue(id, type)[source]¶
Represents a default value of an auto-populated select menu (currently all select menu types except
StringSelectMenu
).Depending on the
type
attribute, this can represent different types of objects.New in version 2.10.
- type¶
The type of the target object.
- Type:
TextInput¶
- class disnake.TextInput[source]¶
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]¶
Represents the type of component.
New in version 2.0.
- action_row¶
Represents the group component which holds different components in a row.
- button¶
Represents a button component.
- string_select¶
Represents a string select component.
New in version 2.7.
- select¶
An alias of
string_select
.
- text_input¶
Represents a text input component.
- user_select¶
Represents a user select component.
New in version 2.7.
- role_select¶
Represents a role select component.
New in version 2.7.
- mentionable_select¶
Represents a mentionable (user/member/role) select component.
New in version 2.7.
- channel_select¶
Represents a channel select component.
New in version 2.7.