fix condition causing open state to be broadcast on every start
This commit is contained in:
parent
c2b4ab9383
commit
a339e71e6d
1 changed files with 6 additions and 1 deletions
|
@ -146,7 +146,12 @@ impl Bot {
|
||||||
#[instrument(skip(self))]
|
#[instrument(skip(self))]
|
||||||
async fn update_open_state(&self) -> Result<OpenState> {
|
async fn update_open_state(&self) -> Result<OpenState> {
|
||||||
let new_state = get_open_state(&self.api).await?;
|
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 {
|
let message = if let OpenState::Open { .. } = new_state {
|
||||||
"opening IT-Syndikat - Ohai!"
|
"opening IT-Syndikat - Ohai!"
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue