From 33674be85ef705e35307a66ffdfa232059386ca6 Mon Sep 17 00:00:00 2001 From: Almeida Date: Mon, 15 Jan 2024 22:29:49 +0000 Subject: [PATCH] feat(Webhook): allow setting `appliedTags` on `send()` (#10027) * feat(Webhook): allow setting `appliedTags` on `send()` * docs: fix grammar Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com> --------- Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com> Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com> --- packages/discord.js/src/structures/MessagePayload.js | 3 +++ packages/discord.js/src/structures/Webhook.js | 4 +++- packages/discord.js/typings/index.d.ts | 1 + 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/discord.js/src/structures/MessagePayload.js b/packages/discord.js/src/structures/MessagePayload.js index 38e8957b8ed1..e42d483780a7 100644 --- a/packages/discord.js/src/structures/MessagePayload.js +++ b/packages/discord.js/src/structures/MessagePayload.js @@ -140,10 +140,12 @@ class MessagePayload { let username; let avatarURL; let threadName; + let appliedTags; if (isWebhook) { username = this.options.username ?? this.target.name; if (this.options.avatarURL) avatarURL = this.options.avatarURL; if (this.options.threadName) threadName = this.options.threadName; + if (this.options.appliedTags) appliedTags = this.options.appliedTags; } let flags; @@ -211,6 +213,7 @@ class MessagePayload { attachments: this.options.attachments, sticker_ids: this.options.stickers?.map(sticker => sticker.id ?? sticker), thread_name: threadName, + applied_tags: appliedTags, }; return this; } diff --git a/packages/discord.js/src/structures/Webhook.js b/packages/discord.js/src/structures/Webhook.js index 266cee864c42..9b2bad0d5467 100644 --- a/packages/discord.js/src/structures/Webhook.js +++ b/packages/discord.js/src/structures/Webhook.js @@ -134,7 +134,9 @@ class Webhook { * @property {string} [avatarURL] Avatar URL override for the message * @property {Snowflake} [threadId] The id of the thread in the channel to send to. * For interaction webhooks, this property is ignored - * @property {string} [threadName] Name of the thread to create (only available if webhook is in a forum channel) + * @property {string} [threadName] Name of the thread to create (only available if the webhook is in a forum channel) + * @property {Snowflake[]} [appliedTags] + * The tags to apply to the created thread (only available if the webhook is in a forum channel) */ /** diff --git a/packages/discord.js/typings/index.d.ts b/packages/discord.js/typings/index.d.ts index 2a8141de532b..cef54e1b8b4f 100644 --- a/packages/discord.js/typings/index.d.ts +++ b/packages/discord.js/typings/index.d.ts @@ -6722,6 +6722,7 @@ export interface WebhookMessageCreateOptions extends Omit