Skip to content

Commit

Permalink
Accept invites to the reporting room
Browse files Browse the repository at this point in the history
  • Loading branch information
thibaultamartin committed Sep 20, 2021
1 parent 1715051 commit 4c85737
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/bot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,18 @@ impl Bot {
// Get matrix rooms
let reporting_room_id = RoomId::try_from(config.reporting_room_id.as_str()).unwrap();
let reporting_room = client
.get_joined_room(&reporting_room_id)
.expect("Unable to get reporting room");
.get_joined_room(&reporting_room_id);

let reporting_room = match reporting_room {
None => {
client
.get_invited_room(&reporting_room_id)
.expect("Not invited to the reporting room")
.accept_invitation().await.expect("Hebbot could not join the reporting room");
client.get_joined_room(&reporting_room_id).expect("Hebbot failed to join")
}
Some(reporting_room) => reporting_room,
};

let admin_room_id = RoomId::try_from(config.admin_room_id.as_str()).unwrap();
let admin_room = client
Expand Down

0 comments on commit 4c85737

Please sign in to comment.