fix condition causing open state to be broadcast on every start

This commit is contained in:
Xiretza 2024-01-30 21:00:36 +00:00
parent c2b4ab9383
commit a339e71e6d

View file

@ -146,7 +146,12 @@ impl Bot {
#[instrument(skip(self))]
async fn update_open_state(&self) -> Result<OpenState> {
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 {