pub struct RadioGroupBuilder { /* private fields */ }Expand description
Builds a radio group for a modal’s label: users pick exactly one of 2-10 options.
At most one option can be selected by default.
discord.js counterpart: RadioGroupBuilder.
Implementations§
Source§impl RadioGroupBuilder
impl RadioGroupBuilder
Sourcepub fn new(custom_id: impl Into<CompactString>) -> Self
pub fn new(custom_id: impl Into<CompactString>) -> Self
Creates a required group without options, sending custom_id (1-100 characters).
discord.js counterpart: new RadioGroupBuilder().setCustomId(…).
Sourcepub fn option(
self,
label: impl Into<CompactString>,
value: impl Into<CompactString>,
) -> Self
pub fn option( self, label: impl Into<CompactString>, value: impl Into<CompactString>, ) -> Self
Adds an option showing label and sending value.
discord.js counterpart: addOptions({ label, value }).
Sourcepub fn option_with(self, option: RadioGroupOptionBuilder) -> Self
pub fn option_with(self, option: RadioGroupOptionBuilder) -> Self
Adds an option with a description or selected by default.
discord.js counterpart: addOptions(new RadioGroupOptionBuilder()…).
Sourcepub fn options<O: Into<GroupOption>>(
self,
options: impl IntoIterator<Item = O>,
) -> Self
pub fn options<O: Into<GroupOption>>( self, options: impl IntoIterator<Item = O>, ) -> Self
Adds several options: option builders or djs-model [GroupOption]s.
discord.js counterpart: addOptions.
Source§impl RadioGroupBuilder
impl RadioGroupBuilder
Sourcepub fn id(self, id: i32) -> Self
pub fn id(self, id: i32) -> Self
Sets the component’s numeric identifier (Discord generates one otherwise); it must be unique in the message or modal.
discord.js counterpart: setId.
Sourcepub fn build(self) -> Result<Component, ValidationError>
pub fn build(self) -> Result<Component, ValidationError>
Checks the component (and what it contains) and returns it.
discord.js counterpart: toJSON of the component builders.
§Errors
The first ValidationError found; see the type docs
for the rules.
Sourcepub fn build_unchecked(self) -> Component
pub fn build_unchecked(self) -> Component
Returns the component without any check (D-180).
discord.js counterpart: toJSON of the component builders with validation off (disableValidators).