Struct serenity::model::interactions::Interaction[][src]

#[non_exhaustive]
pub struct Interaction { pub id: InteractionId, pub application_id: ApplicationId, pub kind: InteractionType, pub data: Option<ApplicationCommandInteractionData>, pub guild_id: Option<GuildId>, pub channel_id: Option<ChannelId>, pub member: Option<Member>, pub user: Option<User>, pub token: String, pub version: u8, }
This is supported on crate feature unstable_discord_api only.
Expand description

Information about an interaction.

An interaction is sent when a user invokes a slash command and is the same for slash commands and other future interaction types.

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: InteractionId
Expand description

Id of the interaction.

application_id: ApplicationId
Expand description

Id of the application this interaction is for.

kind: InteractionType
Expand description

The type of interaction.

data: Option<ApplicationCommandInteractionData>
Expand description

The data of the command which was triggered, if there is one.

Note: It is always present if the interaction kind is ApplicationCommand.

guild_id: Option<GuildId>
Expand description

The guild Id this interaction was sent from, if there is one.

channel_id: Option<ChannelId>
Expand description

The channel Id this interaction was sent from, if there is one.

member: Option<Member>
Expand description

The member data for the invoking user.

Note: It is only present if the interaction is triggered in a guild.

user: Option<User>
Expand description

The user object for the invoking user.

It is only present if the interaction is triggered in DM.

token: String
Expand description

A continuation token for responding to the interaction.

version: u8
Expand description

Always 1.

Implementations

impl Interaction[src]

pub async fn get_interaction_response(
    &self,
    http: impl AsRef<Http>
) -> Result<Message>
[src]

Gets the interaction response.

Errors

Returns an Error::Http if there is no interaction response.

pub async fn create_interaction_response<F>(
    &self,
    http: impl AsRef<Http>,
    f: F
) -> Result<()> where
    F: FnOnce(&mut CreateInteractionResponse) -> &mut CreateInteractionResponse
[src]

Creates a response to the interaction received.

Note: Message contents must be under 2000 unicode code points.

Errors

Returns an Error::Model if the message content is too long. May also return an Error::Http if the API returns an error, or an Error::Json if there is an error in deserializing the API response.

Errors

pub async fn edit_original_interaction_response<F>(
    &self,
    http: impl AsRef<Http>,
    f: F
) -> Result<Message> where
    F: FnOnce(&mut EditInteractionResponse) -> &mut EditInteractionResponse
[src]

Edits the initial interaction response.

application_id will usually be the bot’s UserId, except in cases of bots being very old.

Refer to Discord’s docs for Edit Webhook Message for field information.

Note: Message contents must be under 2000 unicode code points, does not work on ephemeral messages.

Errors

Returns Error::Model if the edited content is too long. May also return Error::Http if the API returns an error, or an Error::Json if there is an error deserializing the response.

pub async fn delete_original_interaction_response(
    &self,
    http: impl AsRef<Http>
) -> Result<()>
[src]

Deletes the initial interaction response.

Errors

May return Error::Http if the API returns an error. Such as if the response was already deleted.

pub async fn create_followup_message<'a, F>(
    &self,
    http: impl AsRef<Http>,
    f: F
) -> Result<Message> where
    F: FnOnce(&'b mut CreateInteractionResponseFollowup<'a>) -> &'b mut CreateInteractionResponseFollowup<'a>, 
[src]

Creates a followup response to the response sent.

Note: Message contents must be under 2000 unicode code points.

Errors

Will return Error::Model if the content is too long. May also return Error::Http if the API returns an error, or a Error::Json if there is an error in deserializing the response.

pub async fn edit_followup_message<'a, F, M: Into<MessageId>>(
    &self,
    http: impl AsRef<Http>,
    message_id: M,
    f: F
) -> Result<Message> where
    F: FnOnce(&'b mut CreateInteractionResponseFollowup<'a>) -> &'b mut CreateInteractionResponseFollowup<'a>, 
[src]

Edits a followup response to the response sent.

Note: Message contents must be under 2000 unicode code points.

Errors

Will return Error::Model if the content is too long. May also return Error::Http if the API returns an error, or a Error::Json if there is an error in deserializing the response.

pub async fn delete_followup_message<M: Into<MessageId>>(
    &self,
    http: impl AsRef<Http>,
    message_id: M
) -> Result<()>
[src]

Deletes a followup message.

Errors

May return Error::Http if the API returns an error. Such as if the response was already deleted.

Trait Implementations

impl Clone for Interaction[src]

fn clone(&self) -> Interaction[src]

Returns a copy of the value. Read more

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl Debug for Interaction[src]

fn fmt(&self, f: &mut Formatter<'_>) -> Result[src]

Formats the value using the given formatter. Read more

impl<'de> Deserialize<'de> for Interaction[src]

fn deserialize<D: Deserializer<'de>>(
    deserializer: D
) -> StdResult<Self, D::Error>
[src]

Deserialize this value from the given Serde deserializer. Read more

impl Serialize for Interaction[src]

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error> where
    __S: Serializer
[src]

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

impl<T> From<T> for T[src]

pub fn from(t: T) -> T[src]

Performs the conversion.

impl<T> Instrument for T[src]

fn instrument(self, span: Span) -> Instrumented<Self>[src]

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

fn in_current_span(self) -> Instrumented<Self>[src]

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

pub fn into(self) -> U[src]

Performs the conversion.

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

pub fn to_owned(&self) -> T[src]

Creates owned data from borrowed data, usually by cloning. Read more

pub fn clone_into(&self, target: &mut T)[src]

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]

Performs the conversion.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]

Performs the conversion.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>, 

pub fn vzip(self) -> V

impl<T> DeserializeOwned for T where
    T: for<'de> Deserialize<'de>, 
[src]