matrix-google-calendar

Bot to manage meetings, pushrules, matrix status as well as showing daily agenda and allowing to shedule stuff.
git clone git://archive.git.mtrnord.blog/MTRNord/matrix-google-calendar.git
Log | Files | Refs

sync.rs (1108B)


      1 use crate::commands::match_command;
      2 use crate::config::Config;
      3 use matrix_sdk::async_trait;
      4 use matrix_sdk::{
      5     events::{
      6         room::member::MemberEventContent, room::message::MessageEventContent, StrippedStateEvent,
      7         SyncMessageEvent,
      8     },
      9     room::Room,
     10     Client, EventHandler,
     11 };
     12 use tokio::sync::mpsc;
     13 use tracing::*;
     14 
     15 #[derive(Debug, Clone)]
     16 pub struct Bot {
     17     client: Client,
     18     config: Config<'static>,
     19 }
     20 
     21 impl Bot {
     22     pub fn new(client: Client, config: Config<'static>) -> Self {
     23         Self {
     24             client,
     25             config: config.clone(),
     26         }
     27     }
     28 }
     29 
     30 #[mrsbfh::commands::commands]
     31 #[mrsbfh::utils::autojoin]
     32 #[async_trait]
     33 impl EventHandler for Bot {
     34     async fn on_room_message(&self, room: Room, event: &SyncMessageEvent<MessageEventContent>) {
     35         if event.sender == self.client.user_id().await.unwrap() {
     36             return;
     37         }
     38     }
     39 
     40     async fn on_stripped_state_member(
     41         &self,
     42         room: Room,
     43         room_member: &StrippedStateEvent<MemberEventContent>,
     44         _: Option<MemberEventContent>,
     45     ) {
     46         // No-Op
     47     }
     48 }