pub struct TextInputBuilder { /* private fields */ }Expand description
Builds a text input
for a modal’s label: one line (short) or several
(paragraph).
min_length is 0-4000, max_length 1-4000 and at least min_length; the pre-filled value
has at most 4000 characters and the placeholder at most 100.
discord.js counterpart: TextInputBuilder.
Implementations§
Source§impl TextInputBuilder
impl TextInputBuilder
Sourcepub fn short(custom_id: impl Into<CompactString>) -> Self
pub fn short(custom_id: impl Into<CompactString>) -> Self
Creates a one-line, required text input sending custom_id (1-100 characters).
discord.js counterpart: setStyle(TextInputStyle.Short).setCustomId(…).
Sourcepub fn paragraph(custom_id: impl Into<CompactString>) -> Self
pub fn paragraph(custom_id: impl Into<CompactString>) -> Self
Creates a multi-line, required text input sending custom_id (1-100 characters).
discord.js counterpart: setStyle(TextInputStyle.Paragraph).setCustomId(…).
Sourcepub fn min_length(self, min_length: u16) -> Self
pub fn min_length(self, min_length: u16) -> Self
Sets the shortest text users may enter (0-4000).
discord.js counterpart: setMinLength.
Sourcepub fn max_length(self, max_length: u16) -> Self
pub fn max_length(self, max_length: u16) -> Self
Sets the longest text users may enter (1-4000, at least the
min_length).
discord.js counterpart: setMaxLength.
Sourcepub fn required(self, required: bool) -> Self
pub fn required(self, required: bool) -> Self
Sets whether the input must be filled to submit the modal (default: yes).
discord.js counterpart: setRequired.
Sourcepub fn value(self, value: impl Into<CompactString>) -> Self
pub fn value(self, value: impl Into<CompactString>) -> Self
Sets the text already filled in (at most 4000 characters).
discord.js counterpart: setValue.
Sourcepub fn placeholder(self, placeholder: impl Into<CompactString>) -> Self
pub fn placeholder(self, placeholder: impl Into<CompactString>) -> Self
Sets the text shown while the input is empty (at most 100 characters).
discord.js counterpart: setPlaceholder.
Source§impl TextInputBuilder
impl TextInputBuilder
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).