Make bot reject invite if it fails
This commit is contained in:
parent
2928e21873
commit
54efdafd11
15
src/main.rs
15
src/main.rs
@ -37,17 +37,10 @@ async fn on_stripped_state_member(room_member: StrippedRoomMemberEvent, client:
|
||||
|
||||
if let Room::Invited(room) = room {
|
||||
tokio::spawn(async move {
|
||||
let mut delay = 2;
|
||||
|
||||
while let Err(err) = room.accept_invitation().await {
|
||||
eprintln!("Warn: {} ({err:?}), retrying in {delay}s", room.room_id());
|
||||
|
||||
sleep(Duration::from_secs(delay)).await;
|
||||
delay *= 2;
|
||||
|
||||
if delay > 3600 {
|
||||
eprintln!("Warn: {} ({err:?})", room.room_id());
|
||||
break;
|
||||
if let Err(err) = room.accept_invitation().await {
|
||||
eprintln!("Err: {err:?}");
|
||||
if let Err(e) = room.reject_invitation().await {
|
||||
eprintln!("Err: {e:?}");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user