phoebe/src/messages.rs

40 lines
929 B
Rust
Raw Normal View History

2021-09-12 02:59:13 +00:00
use serde::{Deserialize, Serialize};
use crate::{channels::ChannelReference, message_ast::MessageContent};
2021-09-12 02:59:13 +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,
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 {
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
}