Skip to content

Commit

Permalink
fix(webhooks): fix not deleting webhooks properly
Browse files Browse the repository at this point in the history
  • Loading branch information
c43721 committed Nov 17, 2024
1 parent 39611f3 commit 0bd8ce5
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/commands/Admin/webhooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,14 @@ export class UserCommand extends PayloadCommand {
return;
}
case "delete": {
await this.container.database.delete(webhook).where(eq(webhook.id, interaction.user.id));
if (!isNullOrUndefinedOrEmpty(guildWebhook?.webhookId)) {
const [wbhk] = await this.database
.select({ id: webhook.id })
.from(webhook)
.where(eq(webhook.id, guildWebhook.webhookId));

await this.container.database.delete(webhook).where(eq(webhook.id, wbhk.id));
}

await interaction.reply({
content: t(LanguageKeys.Commands.Webhook.DeletedWebhook),
Expand Down

0 comments on commit 0bd8ce5

Please sign in to comment.