From ef9caa7a078ad94fba78d496027db6aec3b8c4ab Mon Sep 17 00:00:00 2001 From: Sectly <67114413+Sectly@users.noreply.github.com> Date: Thu, 5 Jun 2025 17:04:35 +0200 Subject: [PATCH] feat(webhooks): add with_components query for Discord's components v2 Implemented the with_components query for post requests to support Discord's new components v2, enabling the use of these new components. --- src/index.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/index.ts b/src/index.ts index bce4f42..49bbd4e 100644 --- a/src/index.ts +++ b/src/index.ts @@ -577,6 +577,7 @@ app.post('/api/webhooks/:id/:token', webhookPostRatelimit, webhookInvalidPostRat const wait = req.query.wait ?? false; const threadId = req.query.thread_id; + const withComponents = req.query.with_components ?? false; const axios = await getClient(req.params.id); @@ -591,6 +592,8 @@ app.post('/api/webhooks/:id/:token', webhookPostRatelimit, webhookInvalidPostRat const response = await axios[0].post( `https://discord.com/api/webhooks/${req.params.id}/${req.params.token}?wait=${wait}${ threadId ? '&thread_id=' + threadId : '' + }${ + withComponents ? '&with_components=' + withComponents : '' }`, body, {