From a339e71e6d7d94433cf89be61c1a31492ae81fb9 Mon Sep 17 00:00:00 2001 From: Xiretza Date: Tue, 30 Jan 2024 21:00:36 +0000 Subject: [PATCH] fix condition causing open state to be broadcast on every start --- src/bot.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/bot.rs b/src/bot.rs index 7ace3c2..479284f 100644 --- a/src/bot.rs +++ b/src/bot.rs @@ -146,7 +146,12 @@ impl Bot { #[instrument(skip(self))] async fn update_open_state(&self) -> Result { let new_state = get_open_state(&self.api).await?; - if *self.open_state.lock().unwrap() != Some(new_state) { + if self + .open_state + .lock() + .unwrap() + .is_some_and(|old_state| old_state != new_state) + { let message = if let OpenState::Open { .. } = new_state { "opening IT-Syndikat - Ohai!" } else {