Skip to content
Merged
Show file tree
Hide file tree
Changes from 7 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
40 changes: 40 additions & 0 deletions packages/discord.js/src/structures/ClientApplication.js
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,36 @@ class ClientApplication extends Application {
this.roleConnectionsVerificationURL ??= null;
}

if ('event_webhooks_url' in data) {
/**
* This application's URL to receive event webhooks
* @type {?string}
*/
this.eventWebhooksURL = data.event_webhooks_url;
} else {
this.eventWebhooksURL ??= null;
}

if ('event_webhooks_status' in data) {
/**
* This application's event webhooks status
* @type {?ApplicationWebhookEventStatus}
*/
this.eventWebhooksStatus = data.event_webhooks_status;
} else {
this.eventWebhooksStatus ??= null;
}

if ('event_webhooks_types' in data) {
/**
* List of event webhooks types this application subscribes to
* @type {?ApplicationWebhookEventType[]}
*/
this.eventWebhooksTypes = data.event_webhooks_types;
} else {
this.eventWebhooksTypes ??= null;
}

/**
* The owner of this OAuth application
* @type {?(User|Team)}
Expand Down Expand Up @@ -284,6 +314,10 @@ class ClientApplication extends Application {
* @property {?(BufferResolvable|Base64Resolvable)} [icon] The application's icon
* @property {?(BufferResolvable|Base64Resolvable)} [coverImage] The application's cover image
* @property {string} [interactionsEndpointURL] The application's interaction endpoint URL
* @property {string} [eventWebhooksURL] The application's event webhooks URL
* @property {ApplicationWebhookEventStatus} [eventWebhooksStatus] The application's event webhooks status.
* Only {@link ApplicationWebhookEventStatus.Enabled} and {@link ApplicationWebhookEventStatus.Disabled} can be set.
* @property {ApplicationWebhookEventType[]} [eventWebhooksTypes] The application's event webhooks types
* @property {string[]} [tags] The application's tags
*/

Expand All @@ -301,6 +335,9 @@ class ClientApplication extends Application {
icon,
coverImage,
interactionsEndpointURL,
eventWebhooksURL,
eventWebhooksStatus,
eventWebhooksTypes,
tags,
} = {}) {
const data = await this.client.rest.patch(Routes.currentApplication(), {
Expand All @@ -313,6 +350,9 @@ class ClientApplication extends Application {
icon: icon && (await resolveImage(icon)),
cover_image: coverImage && (await resolveImage(coverImage)),
interactions_endpoint_url: interactionsEndpointURL,
event_webhooks_url: eventWebhooksURL,
event_webhooks_status: eventWebhooksStatus,
event_webhooks_types: eventWebhooksTypes,
tags,
},
});
Expand Down
10 changes: 10 additions & 0 deletions packages/discord.js/src/util/APITypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,16 @@
* @see {@link https://discord-api-types.dev/api/discord-api-types-v10/enum/ApplicationRoleConnectionMetadataType}
*/

/**
* @external ApplicationWebhookEventStatus
* @see {@link https://discord-api-types.dev/api/discord-api-types-v10/enum/ApplicationWebhookEventStatus}
*/

/**
* @external ApplicationWebhookEventType
* @see {@link https://discord-api-types.dev/api/discord-api-types-v10/enum/ApplicationWebhookEventType}
*/

/**
* @external AttachmentFlags
* @see {@link https://discord-api-types.dev/api/discord-api-types-v10/enum/AttachmentFlags}
Expand Down
8 changes: 8 additions & 0 deletions packages/discord.js/typings/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,8 @@ import {
SubscriptionStatus,
GatewaySendPayload,
GatewayDispatchPayload,
ApplicationWebhookEventStatus,
ApplicationWebhookEventType,
RESTPostAPIInteractionCallbackWithResponseResult,
RESTAPIInteractionCallbackObject,
RESTAPIInteractionCallbackResourceObject,
Expand Down Expand Up @@ -1081,6 +1083,9 @@ export class ClientApplication extends Application {
public owner: User | Team | null;
public get partial(): boolean;
public interactionsEndpointURL: string | null;
public eventWebhooksURL: string | null;
public eventWebhooksStatus: ApplicationWebhookEventStatus | null;
public eventWebhooksTypes: ApplicationWebhookEventType[] | null;
public roleConnectionsVerificationURL: string | null;
public rpcOrigins: string[];
public edit(options: ClientApplicationEditOptions): Promise<ClientApplication>;
Expand Down Expand Up @@ -6972,6 +6977,9 @@ export interface ClientApplicationEditOptions {
icon?: BufferResolvable | Base64Resolvable | null;
coverImage?: BufferResolvable | Base64Resolvable | null;
interactionsEndpointURL?: string;
eventWebhooksURL?: string;
eventWebhooksStatus?: ApplicationWebhookEventStatus;
eventWebhooksTypes?: readonly ApplicationWebhookEventType[];
tags?: readonly string[];
}

Expand Down
Loading