#[non_exhaustive]pub enum Component {
Show 21 variants
ActionRow(ActionRow),
Button(Button),
StringSelect(StringSelect),
TextInput(TextInput),
UserSelect(AutoPopulatedSelect),
RoleSelect(AutoPopulatedSelect),
MentionableSelect(AutoPopulatedSelect),
ChannelSelect(ChannelSelect),
Section(Section),
TextDisplay(TextDisplay),
Thumbnail(Thumbnail),
MediaGallery(MediaGallery),
File(File),
Separator(Separator),
Container(Container),
Label(Label),
FileUpload(FileUpload),
RadioGroup(RadioGroup),
CheckboxGroup(CheckboxGroup),
Checkbox(Checkbox),
Unknown(UnknownComponent),
}Expand description
A component of a message or modal (D-065).
discord.js counterpart: Component and its subclasses.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
ActionRow(ActionRow)
A row of buttons or a select menu.
Button(Button)
A button.
StringSelect(StringSelect)
A select menu of developer-defined options.
TextInput(TextInput)
A text input (modals).
UserSelect(AutoPopulatedSelect)
A select menu of users.
RoleSelect(AutoPopulatedSelect)
A select menu of roles.
MentionableSelect(AutoPopulatedSelect)
A select menu of users and roles.
ChannelSelect(ChannelSelect)
A select menu of channels.
Section(Section)
Text next to an accessory.
TextDisplay(TextDisplay)
Markdown text.
Thumbnail(Thumbnail)
A small image.
MediaGallery(MediaGallery)
A grid of images and videos.
File(File)
An attached file.
Separator(Separator)
Vertical space.
Container(Container)
A box of components.
Label(Label)
A labelled input (modals).
FileUpload(FileUpload)
A file upload (modals).
RadioGroup(RadioGroup)
A single-choice group (modals).
CheckboxGroup(CheckboxGroup)
A multiple-choice group (modals).
Checkbox(Checkbox)
A single checkbox (modals).
Unknown(UnknownComponent)
A component type this version of the library does not know about.
Implementations§
Source§impl Component
impl Component
Sourcepub const fn kind(&self) -> ComponentType
pub const fn kind(&self) -> ComponentType
Returns the component’s type.
discord.js counterpart: Component#type.
Sourcepub const fn id(&self) -> Option<i32>
pub const fn id(&self) -> Option<i32>
Returns the component’s numeric identifier, if set.
discord.js counterpart: Component#id.
Sourcepub fn custom_id(&self) -> Option<&str>
pub fn custom_id(&self) -> Option<&str>
Returns the developer-defined identifier of an interactive component.
discord.js counterpart: the customId of an ActionRowComponent.
Sourcepub fn children(&self) -> &[Self]
pub fn children(&self) -> &[Self]
Returns the child components of an action row, section or container (empty for other
components; see Section::accessory and Label::component for single children).
discord.js counterpart: ActionRow#components.