forked from jmug/stoatchat
feat(messaging): add sendable embeds (#119)
This commit is contained in:
@@ -3,6 +3,7 @@ use crate::util::{
|
||||
variables::JANUARY_URL,
|
||||
variables::MAX_EMBED_COUNT,
|
||||
};
|
||||
use crate::database::entities::microservice::autumn::File;
|
||||
use linkify::{LinkFinder, LinkKind};
|
||||
use regex::Regex;
|
||||
use serde::{Deserialize, Serialize};
|
||||
@@ -92,11 +93,28 @@ pub struct Metadata {
|
||||
colour: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug, Clone)]
|
||||
pub struct Text {
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub icon_url: Option<String>,
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub url: Option<String>,
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub title: Option<String>,
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub description: Option<String>,
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub media: Option<File>,
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub colour: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug, Clone)]
|
||||
#[serde(tag = "type")]
|
||||
pub enum Embed {
|
||||
Website(Metadata),
|
||||
Image(Image),
|
||||
Text(Text),
|
||||
None,
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user