#[non_exhaustive]pub struct CommandOption {Show 14 fields
pub kind: CommandOptionType,
pub name: String,
pub name_localizations: Option<HashMap<String, String>>,
pub description: String,
pub description_localizations: Option<HashMap<String, String>>,
pub required: bool,
pub choices: Vec<CommandOptionChoice>,
pub options: Vec<CommandOption>,
pub channel_types: Vec<ChannelType>,
pub min_value: Option<Number>,
pub max_value: Option<Number>,
pub min_length: Option<u16>,
pub max_length: Option<u16>,
pub autocomplete: bool,
}
Expand description
The parameters for an Command
.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. }
syntax; cannot be matched against without a wildcard ..
; and struct update syntax will not work.kind: CommandOptionType
The option type.
name: String
The option name.
name_localizations: Option<HashMap<String, String>>
Localizations of the option name with locale as the key
description: String
The option description.
description_localizations: Option<HashMap<String, String>>
Localizations of the option description with locale as the key
required: bool
Whether the parameter is optional or required.
choices: Vec<CommandOptionChoice>
Choices the user can pick from.
Note: Only available for String
and Integer
CommandOptionType
.
options: Vec<CommandOption>
The nested options.
Note: Only available for SubCommand
or SubCommandGroup
.
channel_types: Vec<ChannelType>
If the option is a Channel
, it will only be able to show these types.
min_value: Option<Number>
Minimum permitted value for Integer or Number options
max_value: Option<Number>
Maximum permitted value for Integer or Number options
min_length: Option<u16>
Minimum permitted length for String options
max_length: Option<u16>
Maximum permitted length for String options
autocomplete: bool
Trait Implementations§
Source§impl Clone for CommandOption
impl Clone for CommandOption
Source§fn clone(&self) -> CommandOption
fn clone(&self) -> CommandOption
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
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>,
Deserialize this value from the given Serde deserializer. Read more
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
Mutably borrows from an owned value. Read more