use tokio::task::JoinHandle; use anyhow::Result; use async_trait::async_trait; #[async_trait] pub trait Sender { async fn send(&self, message: OutboundMessage) -> Result; } #[async_trait] pub trait Receiver { async fn recv(&self, msg: InboundMessage) -> Result<()>; } #[derive(Debug, Clone)] pub struct OutboundMessage { pub channel_id: String, pub text: String, pub reply_to_event_id: Option, } #[derive(Debug, Clone, PartialEq, Eq, Hash, PartialOrd, Ord)] pub struct InboundMessage { pub event_id: String, pub channel_id: String, pub user_id: String, pub text: String, pub timestamp_ms: u64, } #[derive(Debug, Clone, Default)] pub struct InputBatch { pub messages: Vec, pub next_cursor: Option, } #[async_trait] pub trait AttendanceHandler { async fn handle_commands(&self) -> Result>; } #[derive(Debug, Clone, PartialEq, Eq, Hash, PartialOrd, Ord)] pub enum MessageEnum { MatrixMessage(InboundMessage), TelegramMessage(InboundMessage), StopMessage, } #[async_trait] pub trait Bot { async fn start(&self) -> Result<()>; async fn join_rooms(&self) -> Result<()>; async fn send_raw_message(&self, room_id: &str, message: &OutboundMessage) -> Result; }