Remove auto join code, too buggy

This commit is contained in:
0xf8 2023-04-17 06:07:44 -04:00
parent d757fffb8a
commit 60cd3ba1ad
Signed by: 0xf8
GPG Key ID: 446580D758689584

View File

@ -5,11 +5,9 @@ use matrix_sdk::{
message::{
MessageType, OriginalSyncRoomMessageEvent, Relation, RoomMessageEvent,
},
member::StrippedRoomMemberEvent
},
OwnedRoomId,
},
Client,
Error, LoopCtrl,
};
use std::path::PathBuf;
@ -28,23 +26,6 @@ static ROOMS_CONFIG_FILE: Lazy<PathBuf> = Lazy::new(|| DATA_DIR.join("rooms_conf
static CONFIG: Lazy<config::Config> = Lazy::new(|| config::Config::load());
// Autojoin rooms the bot is invited to
async fn on_stripped_state_member(room_member: StrippedRoomMemberEvent, client: Client, room: Room) {
if room_member.state_key != client.user_id().unwrap() {
return;
}
if let Room::Invited(room) = room {
tokio::spawn(async move {
if let Err(err) = room.accept_invitation().await {
eprintln!("Err: {err:?}");
if let Err(e) = room.reject_invitation().await {
eprintln!("Err: {e:?}");
}
}
});
}
}
async fn on_room_message(event: OriginalSyncRoomMessageEvent, room: Room) -> anyhow::Result<()> {
if let Room::Joined(room) = room {