matrix: Ignore messages sent by the bot

This commit is contained in:
George Kaklamanos 2023-11-18 20:11:49 +02:00
parent 4889318e54
commit e06b720d43
No known key found for this signature in database
GPG key ID: C0CAB8A6BDC9399D

View file

@ -23,12 +23,16 @@ fn open(param: String) {
async fn on_room_message(
event: OriginalSyncMessageLikeEvent<RoomMessageEventContent>,
room: Room,
client: Client,
) {
if let Room::Joined(room) = room {
let msg_body = match event.content.msgtype {
MessageType::Text(TextMessageEventContent { body, .. }) => body,
_ => return,
};
if event.sender == client.user_id().unwrap() {
return;
}
if msg_body == "1" {
open(event.sender.to_string());