Skip to content

Commit

Permalink
feat(Webhook): allow setting appliedTags on send() (#10027)
Browse files Browse the repository at this point in the history
* feat(Webhook): allow setting `appliedTags` on `send()`

* docs: fix grammar

Co-authored-by: Jiralite <[email protected]>

---------

Co-authored-by: Jiralite <[email protected]>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
  • Loading branch information
3 people authored Jan 15, 2024
1 parent 7e12bee commit 33674be
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
3 changes: 3 additions & 0 deletions packages/discord.js/src/structures/MessagePayload.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}
Expand Down
4 changes: 3 additions & 1 deletion packages/discord.js/src/structures/Webhook.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.
* <info>For interaction webhooks, this property is ignored</info>
* @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)
*/

/**
Expand Down
1 change: 1 addition & 0 deletions packages/discord.js/typings/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6722,6 +6722,7 @@ export interface WebhookMessageCreateOptions extends Omit<MessageCreateOptions,
avatarURL?: string;
threadId?: Snowflake;
threadName?: string;
appliedTags?: Snowflake[];
}

export interface WebSocketOptions {
Expand Down

0 comments on commit 33674be

Please sign in to comment.