mirror of
https://github.com/discordeno/discordeno.git
synced 2026-06-02 08:50:07 +00:00
feat(types,rest,bot): Add with_components to webhooks (#4152)
* Add with_components to webhook execute and edit * Fix query param building * update comments
This commit is contained in:
@@ -948,7 +948,7 @@ export type BotHelpers<TProps extends TransformersDesiredProperties, TBehavior e
|
||||
webhookId: BigString,
|
||||
token: string,
|
||||
messageId: BigString,
|
||||
options: InteractionCallbackData & { threadId?: BigString },
|
||||
options: InteractionCallbackData & { threadId?: BigString; withComponents?: boolean },
|
||||
) => Promise<SetupDesiredProps<Message, TProps, TBehavior>>
|
||||
editWebhookWithToken: (
|
||||
webhookId: BigString,
|
||||
|
||||
@@ -13,6 +13,7 @@ export function createRoutes(): RestRoutes {
|
||||
|
||||
if (options) {
|
||||
if (options.threadId) url += `thread_id=${options.threadId}`
|
||||
if (options.withComponents) url += `&with_components=${options.withComponents}`
|
||||
}
|
||||
|
||||
return url
|
||||
@@ -31,7 +32,8 @@ export function createRoutes(): RestRoutes {
|
||||
|
||||
if (options) {
|
||||
if (options?.wait !== undefined) url += `wait=${options.wait.toString()}`
|
||||
if (options.threadId) url += `thread_id=${options.threadId}`
|
||||
if (options.threadId) url += `&thread_id=${options.threadId}`
|
||||
if (options.withComponents) url += `&with_components=${options.withComponents}`
|
||||
}
|
||||
|
||||
return url
|
||||
|
||||
@@ -1483,7 +1483,7 @@ export interface RestManager {
|
||||
webhookId: BigString,
|
||||
token: string,
|
||||
messageId: BigString,
|
||||
options: InteractionCallbackData & { threadId?: BigString },
|
||||
options: InteractionCallbackData & { threadId?: BigString; withComponents?: boolean },
|
||||
) => Promise<Camelize<DiscordMessage>>
|
||||
/**
|
||||
* Edits a webhook using the webhook token, thereby bypassing the need for authentication + permissions.
|
||||
|
||||
@@ -33,9 +33,9 @@ export interface RestRoutes {
|
||||
/** Route for webhook with a id. */
|
||||
id: (webhookId: BigString) => string
|
||||
/** Route for handling a webhook with a token. */
|
||||
webhook: (webhookId: BigString, token: string, options?: { wait?: boolean; threadId?: BigString }) => string
|
||||
webhook: (webhookId: BigString, token: string, options?: { wait?: boolean; threadId?: BigString; withComponents?: boolean }) => string
|
||||
/** Route for handling a message that was sent through a webhook. */
|
||||
message: (webhookId: BigString, token: string, messageId: BigString, options?: { threadId?: BigString }) => string
|
||||
message: (webhookId: BigString, token: string, messageId: BigString, options?: { threadId?: BigString; withComponents?: boolean }) => string
|
||||
}
|
||||
/** Routes for channel related endpoints. */
|
||||
channels: {
|
||||
|
||||
@@ -1062,6 +1062,13 @@ export interface ExecuteWebhook {
|
||||
wait?: boolean
|
||||
/** Send a message to the specified thread within a webhook's channel. The thread will automatically be unarchived. */
|
||||
threadId?: BigString
|
||||
/**
|
||||
* Whether to respect the `components` field of the request.
|
||||
* When enabled, allows application-owned webhooks to use all components and non-owned webhooks to use non-interactive components.
|
||||
*
|
||||
* @default false
|
||||
*/
|
||||
withComponents?: boolean
|
||||
/** Name of the thread to create (target channel has to be type of forum channel) */
|
||||
threadName?: string
|
||||
/** Array of tag ids to apply to the thread (requires the webhook channel to be a forum or media channel) */
|
||||
@@ -1080,7 +1087,13 @@ export interface ExecuteWebhook {
|
||||
embeds?: Camelize<DiscordEmbed>[]
|
||||
/** Allowed mentions for the message */
|
||||
allowedMentions?: AllowedMentions
|
||||
/** the components to include with the message */
|
||||
/**
|
||||
* The components to include with the message
|
||||
*
|
||||
* @remarks
|
||||
* Application-owned webhooks can always send components.
|
||||
* Non-application-owned webhooks cannot send interactive components, and the `components` field will be gnored unless they set the `with_components` query param.
|
||||
*/
|
||||
components?: MessageComponents
|
||||
/** A poll object */
|
||||
poll?: CreatePoll
|
||||
|
||||
Reference in New Issue
Block a user