1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59
#[derive(Debug)] pub struct Embed { pub title: Option<String>, pub description: Option<String>, pub footer: Option<EmbedFooter>, pub author: Option<EmbedAuthor>, pub fields: Vec<EmbedField>, pub color: Option<String>, pub timestamp: Option<String>, } impl Default for Embed { fn default() -> Self { return Self::new(); } } impl Embed { pub fn new() -> Self { return Self { title: None, description: None, footer: None, author: None, fields: Vec::new(), color: None, timestamp: None, }; } pub fn add_field(&mut self, title: String, content: String, inline: bool) { self.fields.push(EmbedField::new(title, content, inline)); } } #[derive(Debug)] pub struct EmbedField { pub title: String, pub content: String, pub inline: bool, } impl EmbedField { pub fn new(title: String, content: String, inline: bool) -> Self { return EmbedField { title, content, inline }; } } #[derive(Debug)] pub struct EmbedFooter { pub text: String, pub icon: Option<String>, } #[derive(Debug)] pub struct EmbedAuthor { pub name: String, pub url: Option<String>, pub avatar: Option<String>, }