Don't delete guild data when guild becomes unavailable

This commit is contained in:
jude 2024-09-17 23:47:27 +01:00
parent b6ff149d51
commit 9a6b65f3a3
2 changed files with 6 additions and 4 deletions

View File

@ -1,6 +1,6 @@
[package] [package]
name = "reminder-rs" name = "reminder-rs"
version = "1.7.26" version = "1.7.27"
authors = ["Jude Southworth <judesouthworth@pm.me>"] authors = ["Jude Southworth <judesouthworth@pm.me>"]
edition = "2021" edition = "2021"
license = "AGPL-3.0 only" license = "AGPL-3.0 only"

View File

@ -55,10 +55,12 @@ To stay up to date on the latest features and fixes, join our [Discord](https://
} }
} }
FullEvent::GuildDelete { incomplete, .. } => { FullEvent::GuildDelete { incomplete, .. } => {
if !incomplete.unavailable {
let _ = sqlx::query!("DELETE FROM guilds WHERE guild = ?", incomplete.id.get()) let _ = sqlx::query!("DELETE FROM guilds WHERE guild = ?", incomplete.id.get())
.execute(&data.database) .execute(&data.database)
.await; .await;
} }
}
FullEvent::InteractionCreate { interaction } => { FullEvent::InteractionCreate { interaction } => {
if let Some(component) = interaction.clone().message_component() { if let Some(component) = interaction.clone().message_component() {
let component_model = ComponentDataModel::from_custom_id(&component.data.custom_id); let component_model = ComponentDataModel::from_custom_id(&component.data.custom_id);