Struct serenity::model::interactions::Interaction [−][src]
#[non_exhaustive]pub struct Interaction { pub id: InteractionId, pub application_id: ApplicationId, pub kind: InteractionType, pub data: Option<InteractionData>, pub message: Option<InteractionMessage>, pub guild_id: Option<GuildId>, pub channel_id: Option<ChannelId>, pub member: Option<Member>, pub user: Option<User>, pub token: String, pub version: u8, }
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
Struct { .. }
syntax; cannot be matched against without a wildcard ..
; and struct update syntax will not work.id: InteractionId
Id of the interaction.
application_id: ApplicationId
Id of the application this interaction is for.
kind: InteractionType
The type of interaction.
data: Option<InteractionData>
The data of the interaction which was triggered.
Note: It is always present if the interaction kind
is not
Ping
.
message: Option<InteractionMessage>
The message this interaction was triggered by, if it is a component.
guild_id: Option<GuildId>
The guild Id this interaction was sent from, if there is one.
channel_id: Option<ChannelId>
The channel Id this interaction was sent from, if there is one.
member: Option<Member>
The member
data for the invoking user.
Note: It is only present if the interaction is triggered in a guild.
user: Option<User>
The user
object for the invoking user.
It is only present if the interaction is triggered in DM.
token: String
A continuation token for responding to the interaction.
version: u8
Always 1
.
Implementations
pub async fn create_interaction_response<F>(
&self,
http: impl AsRef<Http>,
f: F
) -> Result<()> where
F: FnOnce(&mut CreateInteractionResponse) -> &mut CreateInteractionResponse,
[src]
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]
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.
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]
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]
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.
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
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations
impl RefUnwindSafe for Interaction
impl Send for Interaction
impl Sync for Interaction
impl Unpin for Interaction
impl UnwindSafe for Interaction
Blanket Implementations
Mutably borrows from an owned value. Read more
Instruments this type with the provided Span
, returning an
Instrumented
wrapper. Read more
type Output = T
type Output = T
Should always be Self
pub fn vzip(self) -> V