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 moresource§impl Debug for CommandOption
impl Debug for CommandOption
source§impl<'de> Deserialize<'de> for CommandOption
impl<'de> Deserialize<'de> for CommandOption
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
source§impl PartialEq for CommandOption
impl PartialEq for CommandOption
source§impl Serialize for CommandOption
impl Serialize for CommandOption
impl StructuralPartialEq for CommandOption
Auto Trait Implementations§
impl Freeze for CommandOption
impl RefUnwindSafe for CommandOption
impl Send for CommandOption
impl Sync for CommandOption
impl Unpin for CommandOption
impl UnwindSafe for CommandOption
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)