From 9a6b65f3a3af6e4a3c2140f1f259839a96b22db9 Mon Sep 17 00:00:00 2001 From: jude Date: Tue, 17 Sep 2024 23:47:27 +0100 Subject: [PATCH] Don't delete guild data when guild becomes unavailable --- Cargo.toml | 2 +- src/event_handlers.rs | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 7e1192a..6526a94 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "reminder-rs" -version = "1.7.26" +version = "1.7.27" authors = ["Jude Southworth "] edition = "2021" license = "AGPL-3.0 only" diff --git a/src/event_handlers.rs b/src/event_handlers.rs index 80cc258..4fb5347 100644 --- a/src/event_handlers.rs +++ b/src/event_handlers.rs @@ -55,9 +55,11 @@ To stay up to date on the latest features and fixes, join our [Discord](https:// } } FullEvent::GuildDelete { incomplete, .. } => { - let _ = sqlx::query!("DELETE FROM guilds WHERE guild = ?", incomplete.id.get()) - .execute(&data.database) - .await; + if !incomplete.unavailable { + let _ = sqlx::query!("DELETE FROM guilds WHERE guild = ?", incomplete.id.get()) + .execute(&data.database) + .await; + } } FullEvent::InteractionCreate { interaction } => { if let Some(component) = interaction.clone().message_component() {