Some cool features
This commit is contained in:
parent
e6d819d7a8
commit
b7f0b50aad
2 changed files with 37 additions and 5 deletions
BIN
a.out
BIN
a.out
Binary file not shown.
42
src/main.rs
42
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();
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in a new issue