Add in withComponents to Webhook

This commit is contained in:
Elysia
2025-07-08 20:13:33 +07:00
parent 8eb32a16fe
commit e2732da506
2 changed files with 11 additions and 1 deletions

View File

@@ -120,6 +120,8 @@ class Webhook {
* @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] * @property {Snowflake[]} [appliedTags]
* The tags to apply to the created thread (only available if the webhook is in a forum channel) * The tags to apply to the created thread (only available if the webhook is in a forum channel)
* @property {boolean} [withComponents] Whether to allow sending non-interactive components in the message.
* <info>For application-owned webhooks, this property is ignored</info>
*/ */
/** /**
@@ -134,6 +136,8 @@ class Webhook {
* Action rows containing interactive components for the message (buttons, select menus) * Action rows containing interactive components for the message (buttons, select menus)
* @property {Snowflake} [threadId] The id of the thread this message belongs to * @property {Snowflake} [threadId] The id of the thread this message belongs to
* <info>For interaction webhooks, this property is ignored</info> * <info>For interaction webhooks, this property is ignored</info>
* @property {boolean} [withComponents] Whether to allow sending non-interactive components in the message.
* <info>For application-owned webhooks, this property is ignored</info>
*/ */
/** /**
@@ -199,7 +203,11 @@ class Webhook {
const d = await this.client.api.webhooks(this.id, this.token).post({ const d = await this.client.api.webhooks(this.id, this.token).post({
data, data,
files, files,
query: { thread_id: messagePayload.options.threadId, wait: true, with_components: data?.components?.length > 0 }, query: {
thread_id: messagePayload.options.threadId,
wait: true,
with_components: messagePayload.options.withComponents,
},
auth: false, auth: false,
webhook: true, webhook: true,
}); });
@@ -339,6 +347,7 @@ class Webhook {
files, files,
query: { query: {
thread_id: messagePayload.options.threadId, thread_id: messagePayload.options.threadId,
with_components: messagePayload.options.withComponents,
}, },
auth: false, auth: false,
webhook: true, webhook: true,

1
typings/index.d.ts vendored
View File

@@ -7981,6 +7981,7 @@ export interface WebhookMessageOptions extends Omit<MessageOptions, 'nonce' | 'r
threadId?: Snowflake; threadId?: Snowflake;
threadName?: string; threadName?: string;
appliedTags?: Snowflake[]; appliedTags?: Snowflake[];
withComponents?: boolean;
} }
export type WebhookType = keyof typeof WebhookTypes; export type WebhookType = keyof typeof WebhookTypes;