polyphony_types/interfaces/
interaction.rs

1use serde::{Deserialize, Serialize};
2use serde_json::Value;
3use crate::entities::{AllowedMention, Embed};
4use crate::utils::Snowflake;
5
6#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7pub struct Interaction {
8    pub id: Snowflake,
9    pub r#type: InteractionType,
10    pub data: Value,
11    pub guild_id: Snowflake,
12    pub channel_id: Snowflake,
13    pub member_id: Snowflake,
14    pub token: String,
15    pub version: i32,
16}
17
18#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
19pub enum InteractionType {
20    SelfCommand = 0,
21    Ping = 1,
22    ApplicationCommand = 2
23}
24
25pub enum InteractionResponseType {
26    SelfCommandResponse = 0,
27    Pong = 1,
28    Acknowledge = 2,
29    ChannelMessage = 3,
30    ChannelMessageWithSource = 4,
31    AcknowledgeWithSource = 5,
32}
33
34pub struct InteractionApplicationCommandCallbackData {
35    pub tts: bool,
36    pub content: String,
37    pub embeds: Vec<Embed>,
38    pub allowed_mentions: AllowedMention
39}