summary refs log tree commit diff
path: root/src/api/util
diff options
context:
space:
mode:
authorRory& <root@rory.gay>2026-07-08 20:51:49 +0200
committerRory& <root@rory.gay>2026-07-15 12:03:47 +0200
commit3c4e9e6c536c64f803c7eb6643220452218bde82 (patch)
treebaa7ae9e25fb0a9fa73c668fc39445ae490a2d3f /src/api/util
parentFix stacktraces by converting all constant errors to getters (diff)
downloadserver-ts-3c4e9e6c536c64f803c7eb6643220452218bde82.tar.xz
Unify webhook token parameter name
Diffstat (limited to 'src/api/util')
-rw-r--r--src/api/util/handlers/Webhook.ts11
1 files changed, 3 insertions, 8 deletions
diff --git a/src/api/util/handlers/Webhook.ts b/src/api/util/handlers/Webhook.ts

index 1f4f60a7..3e1114ab 100644 --- a/src/api/util/handlers/Webhook.ts +++ b/src/api/util/handlers/Webhook.ts
@@ -28,7 +28,7 @@ export const executeWebhook = async (req: Request, res: Response) => { const body = req.body as WebhookExecuteSchema; const messageId = Snowflake.generate(); - const { webhook_id, token } = req.params as { [key: string]: string }; + const { webhook_id, webhook_token } = req.params as { [key: string]: string }; const webhook = await Webhook.findOne({ where: { @@ -37,13 +37,8 @@ export const executeWebhook = async (req: Request, res: Response) => { relations: { channel: true, guild: true, application: true }, }); - if (!webhook) { - throw DiscordApiErrors.UNKNOWN_WEBHOOK; - } - - if (webhook.token !== token) { - throw DiscordApiErrors.INVALID_WEBHOOK_TOKEN_PROVIDED; - } + if (!webhook) throw DiscordApiErrors.UNKNOWN_WEBHOOK; + if (webhook.token !== webhook_token) throw DiscordApiErrors.INVALID_WEBHOOK_TOKEN_PROVIDED; if (body.username) { ValidateName(body.username);