twilight_model/application/interaction/
metadata.rs

1use serde::{Deserialize, Serialize};
2
3use crate::{
4    id::{
5        marker::{GuildMarker, InteractionMarker, MessageMarker, UserMarker},
6        AnonymizableId, Id,
7    },
8    oauth::ApplicationIntegrationMap,
9    user::User,
10};
11
12use super::InteractionType;
13
14/// Structure containing metadata for interactions.
15#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
16pub struct InteractionMetadata {
17    /// IDs for installation context(s) related to an interaction.
18    pub authorizing_integration_owners:
19        ApplicationIntegrationMap<AnonymizableId<GuildMarker>, Id<UserMarker>>,
20    /// ID of the interaction.
21    pub id: Id<InteractionMarker>,
22    /// ID of the message that contained interactive component, present only on
23    /// messages created from component interactions
24    #[serde(skip_serializing_if = "Option::is_none")]
25    pub interacted_message_id: Option<Id<MessageMarker>>,
26    /// Type of interaction.
27    #[serde(rename = "type")]
28    pub kind: InteractionType,
29    /// ID of the original response message, present only on follow-up messages.
30    #[serde(skip_serializing_if = "Option::is_none")]
31    pub original_response_message_id: Option<Id<MessageMarker>>,
32    /// ID of the message the command was run on, present only on
33    /// message command interactions.
34    #[serde(skip_serializing_if = "Option::is_none")]
35    pub target_message_id: Option<Id<MessageMarker>>,
36    /// User the command was run on, present only on user command
37    /// interactions.
38    #[serde(skip_serializing_if = "Option::is_none")]
39    pub target_user: Option<User>,
40    /// Metadata for the interaction that was used to open the modal,
41    /// present only on modal submit interactions
42    // This field cannot be in the nested interaction metadata.
43    #[serde(skip_serializing_if = "Option::is_none")]
44    pub triggering_interaction_metadata: Option<Box<InteractionMetadata>>,
45    /// User who triggered the interaction.
46    pub user: User,
47}