#[non_exhaustive]pub struct CommandData {
pub id: CommandId,
pub name: String,
pub kind: CommandType,
pub resolved: CommandDataResolved,
pub options: Vec<CommandDataOption>,
pub guild_id: Option<GuildId>,
pub target_id: Option<TargetId>,
}
Expand description
The command data payload.
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.id: CommandId
The Id of the invoked command.
name: String
The name of the invoked command.
kind: CommandType
The application command type of the triggered application command.
resolved: CommandDataResolved
The parameters and the given values. The converted objects from the given options.
options: Vec<CommandDataOption>
§guild_id: Option<GuildId>
The Id of the guild the command is registered to.
target_id: Option<TargetId>
The targeted user or message, if the triggered application command type is User
or
Message
.
Its object data can be found in the resolved
field.
Implementations§
Source§impl CommandData
impl CommandData
Sourcepub fn autocomplete(&self) -> Option<AutocompleteOption<'_>>
pub fn autocomplete(&self) -> Option<AutocompleteOption<'_>>
Returns the autocomplete option from CommandData::options
.
Sourcepub fn options(&self) -> Vec<ResolvedOption<'_>>
pub fn options(&self) -> Vec<ResolvedOption<'_>>
Returns the resolved options from CommandData::options
and CommandData::resolved
.
Sourcepub fn target(&self) -> Option<ResolvedTarget<'_>>
pub fn target(&self) -> Option<ResolvedTarget<'_>>
The target resolved data of target_id
Trait Implementations§
Source§impl Clone for CommandData
impl Clone for CommandData
Source§fn clone(&self) -> CommandData
fn clone(&self) -> CommandData
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 CommandData
impl Debug for CommandData
Source§impl<'de> Deserialize<'de> for CommandData
impl<'de> Deserialize<'de> for CommandData
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 CommandData
impl RefUnwindSafe for CommandData
impl Send for CommandData
impl Sync for CommandData
impl Unpin for CommandData
impl UnwindSafe for CommandData
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