mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-09 16:13:31 +01:00
feat(Webhook): allow setting withComponents (#10792)
* feat(Webhook): allow setting `withComponents` * docs: remove brackets Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com> --------- Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>
This commit is contained in:
@@ -137,6 +137,8 @@ class Webhook {
|
|||||||
* @property {string} [threadName] Name of the thread to create (only available if the 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]
|
* @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>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -144,6 +146,8 @@ class Webhook {
|
|||||||
* @typedef {MessageEditOptions} WebhookMessageEditOptions
|
* @typedef {MessageEditOptions} WebhookMessageEditOptions
|
||||||
* @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>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -217,6 +221,7 @@ class Webhook {
|
|||||||
const query = makeURLSearchParams({
|
const query = makeURLSearchParams({
|
||||||
wait: true,
|
wait: true,
|
||||||
thread_id: messagePayload.options.threadId,
|
thread_id: messagePayload.options.threadId,
|
||||||
|
with_components: messagePayload.options.withComponents,
|
||||||
});
|
});
|
||||||
|
|
||||||
const { body, files } = await messagePayload.resolveFiles();
|
const { body, files } = await messagePayload.resolveFiles();
|
||||||
@@ -338,14 +343,17 @@ class Webhook {
|
|||||||
|
|
||||||
const { body, files } = await messagePayload.resolveBody().resolveFiles();
|
const { body, files } = await messagePayload.resolveBody().resolveFiles();
|
||||||
|
|
||||||
|
const query = makeURLSearchParams({
|
||||||
|
thread_id: messagePayload.options.threadId,
|
||||||
|
with_components: messagePayload.options.withComponents,
|
||||||
|
});
|
||||||
|
|
||||||
const d = await this.client.rest.patch(
|
const d = await this.client.rest.patch(
|
||||||
Routes.webhookMessage(this.id, this.token, typeof message === 'string' ? message : message.id),
|
Routes.webhookMessage(this.id, this.token, typeof message === 'string' ? message : message.id),
|
||||||
{
|
{
|
||||||
body,
|
body,
|
||||||
files,
|
files,
|
||||||
query: messagePayload.options.threadId
|
query,
|
||||||
? makeURLSearchParams({ thread_id: messagePayload.options.threadId })
|
|
||||||
: undefined,
|
|
||||||
auth: false,
|
auth: false,
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|||||||
2
packages/discord.js/typings/index.d.ts
vendored
2
packages/discord.js/typings/index.d.ts
vendored
@@ -6791,6 +6791,7 @@ export interface WebhookEditOptions {
|
|||||||
|
|
||||||
export interface WebhookMessageEditOptions extends MessageEditOptions {
|
export interface WebhookMessageEditOptions extends MessageEditOptions {
|
||||||
threadId?: Snowflake;
|
threadId?: Snowflake;
|
||||||
|
withComponents?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface InteractionEditReplyOptions
|
export interface InteractionEditReplyOptions
|
||||||
@@ -6810,6 +6811,7 @@ export interface WebhookMessageCreateOptions
|
|||||||
threadId?: Snowflake;
|
threadId?: Snowflake;
|
||||||
threadName?: string;
|
threadName?: string;
|
||||||
appliedTags?: readonly Snowflake[];
|
appliedTags?: readonly Snowflake[];
|
||||||
|
withComponents?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface WidgetActivity {
|
export interface WidgetActivity {
|
||||||
|
|||||||
Reference in New Issue
Block a user