2021-09-12 02:59:13 +00:00
|
|
|
use serde::{Deserialize, Serialize};
|
|
|
|
|
2021-09-13 03:20:49 +00:00
|
|
|
use crate::{channels::ChannelReference, message_ast::MessageContent};
|
2021-09-12 02:59:13 +00:00
|
|
|
|
2021-09-14 04:15:37 +00:00
|
|
|
#[derive(Serialize, Deserialize, Clone, PartialEq, Eq, Hash)]
|
2021-09-12 02:59:13 +00:00
|
|
|
pub enum MessageReference {
|
|
|
|
Discord(u64, u64),
|
|
|
|
Matrix(String, String),
|
|
|
|
}
|
|
|
|
|
|
|
|
pub struct MessageAuthor {
|
|
|
|
pub display_name: String,
|
2021-09-28 01:32:53 +00:00
|
|
|
pub avatar_url: String,
|
|
|
|
pub service_name: String,
|
2021-09-12 02:59:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
pub struct SentMessage {
|
|
|
|
pub source: MessageReference,
|
|
|
|
pub content: MessageContent,
|
|
|
|
pub author: MessageAuthor,
|
2021-09-13 19:41:55 +00:00
|
|
|
pub replies_to: Option<MessageReference>,
|
2021-09-12 02:59:13 +00:00
|
|
|
}
|
2021-09-13 02:08:35 +00:00
|
|
|
|
|
|
|
pub struct EditedMessage {
|
|
|
|
pub replacing: MessageReference,
|
|
|
|
pub content: MessageContent,
|
|
|
|
pub author: MessageAuthor,
|
|
|
|
}
|
|
|
|
|
2021-09-16 03:29:00 +00:00
|
|
|
pub struct DeletedMessage {
|
|
|
|
pub reference: MessageReference,
|
|
|
|
}
|
|
|
|
|
2021-09-13 02:08:35 +00:00
|
|
|
pub enum MessageEvent {
|
2021-09-13 03:20:49 +00:00
|
|
|
AdminLinkChannels(Vec<ChannelReference>),
|
2021-09-13 02:08:35 +00:00
|
|
|
Send(SentMessage),
|
|
|
|
Edit(EditedMessage),
|
2021-09-16 03:29:00 +00:00
|
|
|
Delete(DeletedMessage),
|
2021-09-13 02:08:35 +00:00
|
|
|
}
|