#[non_exhaustive]pub struct ComponentInteraction {Show 17 fields
pub id: InteractionId,
pub application_id: ApplicationId,
pub data: ComponentInteractionData,
pub guild_id: Option<GuildId>,
pub channel: Option<PartialChannel>,
pub channel_id: ChannelId,
pub member: Option<Member>,
pub user: User,
pub token: String,
pub version: u8,
pub message: Box<Message>,
pub app_permissions: Option<Permissions>,
pub locale: String,
pub guild_locale: Option<String>,
pub entitlements: Vec<Entitlement>,
pub authorizing_integration_owners: AuthorizingIntegrationOwners,
pub context: Option<InteractionContext>,
}
Expand description
An interaction triggered by a message component.
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.
data: ComponentInteractionData
The data of the interaction which was triggered.
guild_id: Option<GuildId>
The guild Id this interaction was sent from, if there is one.
channel: Option<PartialChannel>
Channel that the interaction was sent from.
channel_id: ChannelId
The channel Id this interaction was sent from.
member: Option<Member>
The member
data for the invoking user.
Note: It is only present if the interaction is triggered in a guild.
user: User
The user
object for the invoking user.
token: String
A continuation token for responding to the interaction.
version: u8
Always 1
.
message: Box<Message>
The message this interaction was triggered by, if it is a component.
app_permissions: Option<Permissions>
Permissions the app or bot has within the channel the interaction was sent from.
locale: String
The selected language of the invoking user.
guild_locale: Option<String>
The guild’s preferred locale.
entitlements: Vec<Entitlement>
For monetized applications, any entitlements of the invoking user.
The owners of the applications that authorized the interaction, such as a guild or user.
context: Option<InteractionContext>
The context where the interaction was triggered from.
Implementations§
Source§impl<'de> ComponentInteraction
impl<'de> ComponentInteraction
pub fn deserialize<__D>(
__deserializer: __D,
) -> Result<ComponentInteraction, __D::Error>where
__D: Deserializer<'de>,
Source§impl ComponentInteraction
impl ComponentInteraction
pub fn serialize<__S>(
__self: &ComponentInteraction,
__serializer: __S,
) -> Result<__S::Ok, __S::Error>where
__S: Serializer,
Source§impl ComponentInteraction
impl ComponentInteraction
Sourcepub async fn create_response(
&self,
cache_http: impl CacheHttp,
builder: CreateInteractionResponse,
) -> Result<()>
pub async fn create_response( &self, cache_http: impl CacheHttp, builder: CreateInteractionResponse, ) -> Result<()>
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.
Sourcepub async fn edit_response(
&self,
cache_http: impl CacheHttp,
builder: EditInteractionResponse,
) -> Result<Message>
pub async fn edit_response( &self, cache_http: impl CacheHttp, builder: EditInteractionResponse, ) -> Result<Message>
Edits the initial interaction response.
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.
Sourcepub async fn delete_response(&self, http: impl AsRef<Http>) -> Result<()>
pub async fn delete_response(&self, http: impl AsRef<Http>) -> Result<()>
Deletes the initial interaction response.
Does not work on ephemeral messages.
§Errors
May return Error::Http
if the API returns an error. Such as if the response was already
deleted.
Sourcepub async fn create_followup(
&self,
cache_http: impl CacheHttp,
builder: CreateInteractionResponseFollowup,
) -> Result<Message>
pub async fn create_followup( &self, cache_http: impl CacheHttp, builder: CreateInteractionResponseFollowup, ) -> Result<Message>
Creates a followup response to the response sent.
Note: Message contents must be under 2000 unicode code points.
§Errors
Returns Error::Model
if the content is too long. May also return Error::Http
if the
API returns an error, or Error::Json
if there is an error in deserializing the
response.
Sourcepub async fn edit_followup(
&self,
cache_http: impl CacheHttp,
message_id: impl Into<MessageId>,
builder: CreateInteractionResponseFollowup,
) -> Result<Message>
pub async fn edit_followup( &self, cache_http: impl CacheHttp, message_id: impl Into<MessageId>, builder: CreateInteractionResponseFollowup, ) -> Result<Message>
Edits a followup response to the response sent.
Note: Message contents must be under 2000 unicode code points.
§Errors
Returns Error::Model
if the content is too long. May also return Error::Http
if the
API returns an error, or Error::Json
if there is an error in deserializing the
response.
Sourcepub async fn delete_followup<M: Into<MessageId>>(
&self,
http: impl AsRef<Http>,
message_id: M,
) -> Result<()>
pub async fn delete_followup<M: Into<MessageId>>( &self, http: impl AsRef<Http>, message_id: M, ) -> Result<()>
Deletes a followup message.
§Errors
May return Error::Http
if the API returns an error. Such as if the response was already
deleted.
Sourcepub async fn get_followup<M: Into<MessageId>>(
&self,
http: impl AsRef<Http>,
message_id: M,
) -> Result<Message>
pub async fn get_followup<M: Into<MessageId>>( &self, http: impl AsRef<Http>, message_id: M, ) -> Result<Message>
Gets a followup message.
§Errors
May return Error::Http
if the API returns an error. Such as if the response was
deleted.
Sourcepub async fn defer(&self, cache_http: impl CacheHttp) -> Result<()>
pub async fn defer(&self, cache_http: impl CacheHttp) -> Result<()>
Helper function to defer an interaction.
§Errors
Returns an Error::Http
if the API returns an error, or an Error::Json
if there is
an error in deserializing the API response.
Sourcepub async fn defer_ephemeral(&self, cache_http: impl CacheHttp) -> Result<()>
pub async fn defer_ephemeral(&self, cache_http: impl CacheHttp) -> Result<()>
Helper function to defer an interaction ephemerally
§Errors
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.
Sourcepub async fn quick_modal(
&self,
ctx: &Context,
builder: CreateQuickModal,
) -> Result<Option<QuickModalResponse>>
pub async fn quick_modal( &self, ctx: &Context, builder: CreateQuickModal, ) -> Result<Option<QuickModalResponse>>
Trait Implementations§
Source§impl Clone for ComponentInteraction
impl Clone for ComponentInteraction
Source§fn clone(&self) -> ComponentInteraction
fn clone(&self) -> ComponentInteraction
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more