mirror of
https://github.com/matrix-org/matrix-rust-sdk.git
synced 2026-05-04 14:04:40 -04:00
Remove Room enum
This commit is contained in:
committed by
Jonas Platte
parent
85f66b1f96
commit
67ef9c3fa0
@@ -2,31 +2,32 @@ use std::{env, process::exit};
|
||||
|
||||
use matrix_sdk::{
|
||||
config::SyncSettings,
|
||||
room::Room,
|
||||
room,
|
||||
ruma::events::room::message::{
|
||||
MessageType, OriginalSyncRoomMessageEvent, RoomMessageEventContent,
|
||||
},
|
||||
Client,
|
||||
Client, RoomState,
|
||||
};
|
||||
|
||||
async fn on_room_message(event: OriginalSyncRoomMessageEvent, room: Room) {
|
||||
if let Room::Joined(room) = room {
|
||||
let MessageType::Text(text_content) = event.content.msgtype else {
|
||||
return;
|
||||
};
|
||||
async fn on_room_message(event: OriginalSyncRoomMessageEvent, room: room::Common) {
|
||||
if room.state() != RoomState::Joined {
|
||||
return;
|
||||
}
|
||||
let MessageType::Text(text_content) = event.content.msgtype else {
|
||||
return;
|
||||
};
|
||||
|
||||
if text_content.body.contains("!party") {
|
||||
let content = RoomMessageEventContent::text_plain("🎉🎊🥳 let's PARTY!! 🥳🎊🎉");
|
||||
if text_content.body.contains("!party") {
|
||||
let content = RoomMessageEventContent::text_plain("🎉🎊🥳 let's PARTY!! 🥳🎊🎉");
|
||||
|
||||
println!("sending");
|
||||
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();
|
||||
// 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");
|
||||
}
|
||||
println!("message sent");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user