Merge branch 'jude/fix-dashboard-patreon' into current

This commit is contained in:
jude
2024-09-21 10:11:19 +01:00
6 changed files with 10 additions and 9 deletions

View File

@ -20,7 +20,7 @@ pub async fn delete_macro(
SELECT m.id
FROM command_macro m
INNER JOIN guilds
ON guilds.guild = m.guild_id
ON guilds.id = m.guild_id
WHERE guild = ?
AND m.name = ?
",

View File

@ -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() {

View File

@ -68,7 +68,7 @@ impl Data {
guild_id: GuildId,
) -> Result<Vec<CommandMacro>, Error> {
let rows = sqlx::query!(
"SELECT name, description, commands FROM macro WHERE guild_id = (SELECT id FROM guilds WHERE guild = ?)",
"SELECT name, description, commands FROM command_macro WHERE guild_id = (SELECT id FROM guilds WHERE guild = ?)",
guild_id.get()
)
.fetch_all(&self.database)
@ -76,7 +76,7 @@ impl Data {
guild_id,
name: row.name.clone(),
description: row.description.clone(),
commands: serde_json::from_str(&row.commands).unwrap(),
commands: serde_json::from_str(&row.commands.to_string()).unwrap(),
}).collect();
Ok(rows)