twilight_model/application/interaction/callback/
mod.rs

1//! [`InteractionCallbackResponse`] that is returned when creating an interaction response, only when querying with it.
2//!
3//! See [Discord Docs/Interaction Callback].
4//!
5//! [`InteractionCallbackResponse`]: crate::application::interaction::callback::response::InteractionCallbackResponse
6//! [Discord Docs/Interaction Callback]: https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-callback
7
8mod activity_instance_resource;
9mod resource;
10mod response;
11
12pub use activity_instance_resource::ActivityInstanceResource;
13
14pub use resource::InteractionCallbackResource;
15
16pub use response::InteractionCallbackResponse;
17
18use serde::Deserialize;
19
20use crate::id::{
21    Id,
22    marker::{InteractionMarker, MessageMarker},
23};
24
25use super::InteractionType;
26
27/// Interaction object associated with the interaction response.
28///
29/// See [Discord Docs/Interaction Callback Object]
30///
31/// [Discord Docs/Interaction Callback Object]: https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-callback-interaction-callback-object
32#[derive(Clone, Debug, Deserialize, PartialEq)]
33pub struct InteractionCallback {
34    /// Instance ID of the Activity if one was launched or joined
35    #[serde(skip_serializing_if = "Option::is_none")]
36    pub activity_instance_id: Option<String>,
37    /// ID of the interaction.
38    pub id: Id<InteractionMarker>,
39    /// Interaction type.
40    #[serde(rename = "type")]
41    pub kind: InteractionType,
42    /// Whether the response message is ephemeral
43    #[serde(skip_serializing_if = "Option::is_none")]
44    pub response_message_ephemeral: Option<bool>,
45    /// ID of the message that was created by the interaction
46    #[serde(skip_serializing_if = "Option::is_none")]
47    pub response_message_id: Option<Id<MessageMarker>>,
48    /// Whether the message is in a loading state
49    #[serde(skip_serializing_if = "Option::is_none")]
50    pub response_message_loading: Option<bool>,
51}