#[non_exhaustive]pub struct StringOption {
pub name: CompactString,
pub name_localizations: BTreeMap<Locale, CompactString>,
pub description: CompactString,
pub description_localizations: BTreeMap<Locale, CompactString>,
pub name_localized: Option<CompactString>,
pub description_localized: Option<CompactString>,
pub required: bool,
pub choices: Vec<Choice<CompactString>>,
pub min_length: Option<u16>,
pub max_length: Option<u16>,
pub autocomplete: bool,
}Expand description
A string option.
discord.js counterpart: APIApplicationCommandStringOption (discord-api-types).
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.name: CompactStringThe name (1-32 characters).
name_localizations: BTreeMap<Locale, CompactString>Translations of the name.
description: CompactStringThe description (1-100 characters).
description_localizations: BTreeMap<Locale, CompactString>Translations of the description.
name_localized: Option<CompactString>The name in the requester’s locale, from endpoints that do not return the full translations.
description_localized: Option<CompactString>The description in the requester’s locale (see name_localized).
required: boolWhether the option must be filled.
choices: Vec<Choice<CompactString>>The values to choose from (max 25; values up to 100 characters).
min_length: Option<u16>The minimum length (0-6000).
max_length: Option<u16>The maximum length (1-6000).
autocomplete: boolWhether the app suggests values through autocomplete interactions (not with
choices).
Implementations§
Source§impl StringOption
impl StringOption
Sourcepub fn new(
name: impl Into<CompactString>,
description: impl Into<CompactString>,
) -> Self
pub fn new( name: impl Into<CompactString>, description: impl Into<CompactString>, ) -> Self
Creates an optional string option without choices or bounds, named name and described by description, without translations.
Nothing is validated; djs-builders checks Discord’s rules.
discord.js counterpart: SlashCommandStringOption (@discordjs/builders).