feat(Webhook): allow setting appliedTags on send()

#10027 backport
This commit is contained in:
Elysia
2024-09-17 18:40:39 +07:00
parent 6dde343f9f
commit c1367507aa
3 changed files with 6 additions and 0 deletions

View File

@@ -145,10 +145,12 @@ class MessagePayload {
let username; let username;
let avatarURL; let avatarURL;
let threadName; let threadName;
let appliedTags;
if (isWebhook) { if (isWebhook) {
username = this.options.username ?? this.target.name; username = this.options.username ?? this.target.name;
if (this.options.avatarURL) avatarURL = this.options.avatarURL; if (this.options.avatarURL) avatarURL = this.options.avatarURL;
if (this.options.threadName) threadName = this.options.threadName; if (this.options.threadName) threadName = this.options.threadName;
if (this.options.appliedTags) appliedTags = this.options.appliedTags;
} }
let flags; let flags;
@@ -231,6 +233,7 @@ class MessagePayload {
attachments: this.options.attachments, attachments: this.options.attachments,
sticker_ids: this.options.stickers?.map(sticker => sticker.id ?? sticker), sticker_ids: this.options.stickers?.map(sticker => sticker.id ?? sticker),
thread_name: threadName, thread_name: threadName,
applied_tags: appliedTags,
poll: this.options.poll instanceof MessagePoll ? this.options.poll.toJSON() : this.options.poll, poll: this.options.poll instanceof MessagePoll ? this.options.poll.toJSON() : this.options.poll,
}; };
return this; return this;

View File

@@ -118,6 +118,8 @@ class Webhook {
* <info>For interaction webhooks, this property is ignored</info> * <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 webhook is in a forum channel)
* @property {MessageFlags} [flags] Which flags to set for the message. Only `SUPPRESS_EMBEDS` can be set. * @property {MessageFlags} [flags] Which flags to set for the message. Only `SUPPRESS_EMBEDS` can be set.
* @property {Snowflake[]} [appliedTags]
* The tags to apply to the created thread (only available if the webhook is in a forum channel)
*/ */
/** /**

1
typings/index.d.ts vendored
View File

@@ -7589,6 +7589,7 @@ export interface WebhookMessageOptions extends Omit<MessageOptions, 'reply' | 's
avatarURL?: string; avatarURL?: string;
threadId?: Snowflake; threadId?: Snowflake;
threadName?: string; threadName?: string;
appliedTags?: Snowflake[];
} }
export type WebhookType = keyof typeof WebhookTypes; export type WebhookType = keyof typeof WebhookTypes;