pub struct CommandOption {Show 14 fields
pub autocomplete: Option<bool>,
pub channel_types: Option<Vec<ChannelType>>,
pub choices: Option<Vec<CommandOptionChoice>>,
pub description: String,
pub description_localizations: Option<HashMap<String, String>>,
pub kind: CommandOptionType,
pub max_length: Option<u16>,
pub max_value: Option<CommandOptionValue>,
pub min_length: Option<u16>,
pub min_value: Option<CommandOptionValue>,
pub name: String,
pub name_localizations: Option<HashMap<String, String>>,
pub options: Option<Vec<CommandOption>>,
pub required: Option<bool>,
}
Expand description
Option for a Command
.
Fields not applicable to the command option’s CommandOptionType
should
be set to None
.
Fields’ default values may be used by setting them to None
.
Choices, descriptions and names may be localized in any available locale, see Discord Docs/Localization.
Fields§
§autocomplete: Option<bool>
Whether the command supports autocomplete.
Applicable for options of type Integer
, Number
, and String
.
Defaults to false
.
Note: may not be set to true
if choices
are set.
channel_types: Option<Vec<ChannelType>>
List of possible channel types users can select from.
Applicable for options of type Channel
.
Defaults to any channel type.
choices: Option<Vec<CommandOptionChoice>>
List of predetermined choices users can select from.
Applicable for options of type Integer
, Number
, and String
.
Defaults to no choices; users may input a value of their choice.
Must be at most 25 options.
Note: all choices must be of the same type.
description: String
Description of the option. Must be 100 characters or less.
description_localizations: Option<HashMap<String, String>>
Localization dictionary for the description
field.
Defaults to no localizations.
Keys must be valid locales and values must be 100 characters or less.
kind: CommandOptionType
Type of option.
max_length: Option<u16>
Maximum allowed value length.
Applicable for options of type String
.
Defaults to 6000
.
Must be at least 1
and at most 6000
.
max_value: Option<CommandOptionValue>
§min_length: Option<u16>
Minimum allowed value length.
Applicable for options of type String
.
Defaults to 0
.
Must be at most 6000
.
min_value: Option<CommandOptionValue>
§name: String
Name of the option. Must be 32 characters or less.
name_localizations: Option<HashMap<String, String>>
Localization dictionary for the name
field.
Defaults to no localizations.
Keys must be valid locales and values must be 32 characters or less.
options: Option<Vec<CommandOption>>
Nested options.
Applicable for options of type SubCommand
and SubCommandGroup
.
Defaults to no options.
Note: at least one option is required and SubCommandGroup
may
only contain SubCommand
s.
required: Option<bool>
Whether the option is required.
Applicable for all options except those of type SubCommand
and
SubCommandGroup
.
Defaults to false
.
Trait Implementations§
Source§impl Clone for CommandOption
impl Clone for CommandOption
Source§fn clone(&self) -> CommandOption
fn clone(&self) -> CommandOption
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more