diff --git a/a.out b/a.out deleted file mode 100755 index 5f634bf..0000000 Binary files a/a.out and /dev/null differ diff --git a/src/main.rs b/src/main.rs index be4fcf7..91c276a 100644 --- a/src/main.rs +++ b/src/main.rs @@ -3,10 +3,10 @@ use std::{env, process::exit}; use matrix_sdk::{ config::SyncSettings, room::Room, - ruma::events::room::{ + ruma::events::{room::{ member::StrippedRoomMemberEvent, message::{MessageType, OriginalSyncRoomMessageEvent, RoomMessageEventContent}, - }, + }, relation::Annotation, reaction::ReactionEventContent}, Client, }; use tokio::time::{sleep, Duration}; @@ -145,11 +145,43 @@ async fn on_room_message(event: OriginalSyncRoomMessageEvent, room: Room) { println!("sending"); - // send our message to the room we found the "!party" command in - // the last parameter is an optional transaction id which we don't - // care about. room.send(content, None).await.unwrap(); println!("message sent"); } + +/* + if text_content.body.contains("!timo") || text_content.body.contains("!Timo") { + let content = RoomMessageEventContent::text_plain("☢️☢️☢️"); + + println!("sending"); + + room.send(content, None).await.unwrap(); + + println!("message sent"); + + }*/ + + if text_content.body.contains("!timo") { + let reaction = ReactionEventContent::new( + Annotation::new( + event.event_id.to_owned(), + "TIMO".to_owned() + ) + ); + + room.send(reaction, None).await.unwrap(); + } + + if text_content.body.contains("\\") { + let reaction = ReactionEventContent::new( + Annotation::new( + event.event_id.to_owned(), + text_content.body.replace("\\", "λ").replace("!lambda ","").to_owned() + ) + ); + + room.send(reaction, None).await.unwrap(); + } + } \ No newline at end of file