Skip to main content

mutiny_rs/model/
embed.rs

1use serde::{Deserialize, Serialize};
2
3#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
4#[serde(tag = "type")] // Revolt distinguishes types by the "type" field
5pub enum Embed {
6    /// Used for links and bot-created embeds
7    Website(WebsiteEmbed),
8    /// Used when a user uploads an image
9    Image(ImageEmbed),
10    /// Used when a user uploads a video
11    Video(VideoEmbed),
12    /// Sometimes used for pure text updates
13    Text(WebsiteEmbed),
14    /// Fallback for unknown types
15    None,
16}
17
18#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
19pub struct WebsiteEmbed {
20    pub url: Option<String>,
21    pub title: Option<String>,
22    pub description: Option<String>,
23    pub icon_url: Option<String>,
24    pub colour: Option<String>,
25}
26
27#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
28pub struct ImageEmbed {
29    pub url: String,
30    pub width: usize,
31    pub height: usize,
32    pub size: String, // "Large" or "Preview"
33}
34
35#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
36pub struct VideoEmbed {
37    pub url: String,
38    pub width: usize,
39    pub height: usize,
40}