summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/api/routes/webhooks/#webhook_id/#token/index.ts5
-rw-r--r--src/api/routes/webhooks/#webhook_id/index.ts1
2 files changed, 5 insertions, 1 deletions
diff --git a/src/api/routes/webhooks/#webhook_id/#token/index.ts b/src/api/routes/webhooks/#webhook_id/#token/index.ts

index e5f52c3d..a832c8a2 100644 --- a/src/api/routes/webhooks/#webhook_id/#token/index.ts +++ b/src/api/routes/webhooks/#webhook_id/#token/index.ts
@@ -20,10 +20,12 @@ import { Request, Response, Router } from "express"; import { HTTPError } from "lambert-server/HTTPError"; import multer from "multer"; import { route } from "@spacebar/api/util/handlers/route"; -import { Webhook } from "@spacebar/database"; +import { Webhook, Message } from "@spacebar/database"; import { Config, DiscordApiErrors, emitEvent, handleFile, ValidateName, WebhooksUpdateEvent } from "@spacebar/util"; import { executeWebhook } from "@spacebar/api/util/handlers/Webhook"; import { WebhookUpdateSchema } from "@spacebar/schemas"; +import { FindOptionsWhere } from "typeorm"; + const router = Router({ mergeParams: true }); router.get( @@ -138,6 +140,7 @@ router.delete( throw DiscordApiErrors.INVALID_WEBHOOK_TOKEN_PROVIDED; } const channel_id = webhook.channel_id; + await Message.delete({ channel_id, webhook_id }); await Webhook.delete({ id: webhook_id }); await emitEvent({ diff --git a/src/api/routes/webhooks/#webhook_id/index.ts b/src/api/routes/webhooks/#webhook_id/index.ts
index 78eb27e6..ae2a8b0a 100644 --- a/src/api/routes/webhooks/#webhook_id/index.ts +++ b/src/api/routes/webhooks/#webhook_id/index.ts
@@ -101,6 +101,7 @@ router.delete( } satisfies MessageDeleteBulkEvent); } + await Message.delete({ channel_id, webhook_id }); await Webhook.delete({ id: webhook_id }); await emitEvent({