pub struct CheckboxGroupBuilder { /* private fields */ }Expand description
Builds a checkbox group for a modal’s label: users check some of 1-10 options.
min_values is 0-10 (at least 1 while the group is required) and max_values 1-10 (by
default all options), with at least max_values options.
discord.js counterpart: CheckboxGroupBuilder.
Implementations§
Source§impl CheckboxGroupBuilder
impl CheckboxGroupBuilder
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 CheckboxGroupBuilder().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: CheckboxGroupOptionBuilder) -> Self
pub fn option_with(self, option: CheckboxGroupOptionBuilder) -> Self
Adds an option with a description or checked by default.
discord.js counterpart: addOptions(new CheckboxGroupOptionBuilder()…).
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.
Sourcepub fn min_values(self, min_values: u8) -> Self
pub fn min_values(self, min_values: u8) -> Self
Sets how many options must be checked at least (0-10; Discord’s default: 1).
discord.js counterpart: setMinValues.
Sourcepub fn max_values(self, max_values: u8) -> Self
pub fn max_values(self, max_values: u8) -> Self
Sets how many options can be checked at most (1-10; Discord’s default: all).
discord.js counterpart: setMaxValues.
Source§impl CheckboxGroupBuilder
impl CheckboxGroupBuilder
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).