forked from jmug/stoatchat
Add a way to send messages with attachments.
This commit is contained in:
21
src/database/entities/autumn.rs
Normal file
21
src/database/entities/autumn.rs
Normal file
@@ -0,0 +1,21 @@
|
||||
use serde::{Serialize, Deserialize};
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug, Clone)]
|
||||
#[serde(tag = "type")]
|
||||
enum Metadata {
|
||||
File,
|
||||
Image { width: isize, height: isize },
|
||||
Video { width: isize, height: isize },
|
||||
Audio,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug, Clone)]
|
||||
pub struct File {
|
||||
#[serde(rename = "_id")]
|
||||
pub id: String,
|
||||
filename: String,
|
||||
metadata: Metadata,
|
||||
content_type: String,
|
||||
|
||||
message_id: Option<String>
|
||||
}
|
||||
@@ -19,6 +19,8 @@ pub struct Message {
|
||||
|
||||
pub content: String,
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub attachment: Option<File>,
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub edited: Option<DateTime>,
|
||||
}
|
||||
|
||||
@@ -31,6 +33,7 @@ impl Message {
|
||||
author,
|
||||
|
||||
content,
|
||||
attachment: None,
|
||||
edited: None,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,8 +2,10 @@ mod channel;
|
||||
mod guild;
|
||||
mod message;
|
||||
mod user;
|
||||
mod autumn;
|
||||
|
||||
pub use channel::*;
|
||||
pub use guild::*;
|
||||
pub use message::*;
|
||||
pub use user::*;
|
||||
pub use autumn::*;
|
||||
|
||||
Reference in New Issue
Block a user