Skip to content

feat(webhook): Support with_components #10945

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 22, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 9 additions & 8 deletions packages/core/src/api/webhook.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
type RESTPatchAPIWebhookJSONBody,
type RESTPatchAPIWebhookResult,
type RESTPatchAPIWebhookWithTokenMessageJSONBody,
type RESTPatchAPIWebhookWithTokenMessageQuery,
type RESTPatchAPIWebhookWithTokenMessageResult,
type RESTPostAPIWebhookWithTokenGitHubQuery,
type RESTPostAPIWebhookWithTokenJSONBody,
Expand All @@ -21,10 +22,10 @@ import {
export type CreateWebhookMessageOptions = RESTPostAPIWebhookWithTokenJSONBody &
RESTPostAPIWebhookWithTokenQuery & { files?: RawFile[] };

export type EditWebhookMessageOptions = RESTPatchAPIWebhookWithTokenMessageJSONBody & {
files?: RawFile[];
thread_id?: string;
};
export type EditWebhookMessageOptions = RESTPatchAPIWebhookWithTokenMessageJSONBody &
RESTPatchAPIWebhookWithTokenMessageQuery & {
files?: RawFile[];
};

export class WebhooksAPI {
public constructor(private readonly rest: REST) {}
Expand Down Expand Up @@ -132,11 +133,11 @@ export class WebhooksAPI {
public async execute(
id: Snowflake,
token: string,
{ wait, thread_id, files, ...body }: CreateWebhookMessageOptions,
{ wait, thread_id, with_components, files, ...body }: CreateWebhookMessageOptions,
{ signal }: Pick<RequestData, 'signal'> = {},
) {
return this.rest.post(Routes.webhook(id, token), {
query: makeURLSearchParams({ wait, thread_id }),
query: makeURLSearchParams({ wait, thread_id, with_components }),
files,
body,
auth: false,
Expand Down Expand Up @@ -232,11 +233,11 @@ export class WebhooksAPI {
id: Snowflake,
token: string,
messageId: Snowflake,
{ thread_id, files, ...body }: EditWebhookMessageOptions,
{ thread_id, with_components, files, ...body }: EditWebhookMessageOptions,
{ signal }: Pick<RequestData, 'signal'> = {},
) {
return this.rest.patch(Routes.webhookMessage(id, token, messageId), {
query: makeURLSearchParams({ thread_id }),
query: makeURLSearchParams({ thread_id, with_components }),
auth: false,
body,
signal,
Expand Down