From d16280512cbdfa0179f3df8fc8bc9081c6056e4f Mon Sep 17 00:00:00 2001 From: ITOH <72305210+itohatweb@users.noreply.github.com> Date: Tue, 4 May 2021 22:36:00 +0200 Subject: [PATCH] add: webhook thread support --- src/helpers/webhooks/send_webhook.ts | 6 +++--- src/types/webhooks/execute_webhook.ts | 2 ++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/helpers/webhooks/send_webhook.ts b/src/helpers/webhooks/send_webhook.ts index e627e485a..20cd92e46 100644 --- a/src/helpers/webhooks/send_webhook.ts +++ b/src/helpers/webhooks/send_webhook.ts @@ -66,9 +66,9 @@ export async function sendWebhook( const result = await rest.runMethod( "post", - `${endpoints.WEBHOOK(webhookId, webhookToken)}${ - options.wait ? "?wait=true" : "" - }`, + `${endpoints.WEBHOOK(webhookId, webhookToken)}?wait=${ + options.wait ? "true" : "false" + }${options.threadId ? `&thread_id=${options.threadId}` : ""}`, { ...options, allowed_mentions: options.allowedMentions, diff --git a/src/types/webhooks/execute_webhook.ts b/src/types/webhooks/execute_webhook.ts index 9268f21bf..bce114c30 100644 --- a/src/types/webhooks/execute_webhook.ts +++ b/src/types/webhooks/execute_webhook.ts @@ -7,6 +7,8 @@ import { SnakeCasedPropertiesDeep } from "../util.ts"; export interface ExecuteWebhook { /** Waits for server confirmation of message send before response, and returns the created message body (defaults to `false`; when `false` a message that is not saved does not return an error) */ wait?: boolean; + /** Send a message to the specified thread within a webhook's channel. The thread will automatically be unarchived. */ + threadId?: bigint; /** The message contents (up to 2000 characters) */ content?: string; /** Override the default username of the webhook */