Skip to content

Commit 93638b7

Browse files
committed
Add a few missing application properties
1 parent 6ddf7e2 commit 93638b7

File tree

4 files changed

+35
-0
lines changed

4 files changed

+35
-0
lines changed

lib/Constants.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1513,6 +1513,19 @@ export enum ActivityLocationKind {
15131513
PRIVATE_CHANNEL = "pc",
15141514
}
15151515

1516+
export enum ApplicationEventWebhookStatus {
1517+
DISABLED = 1,
1518+
ENABLED = 2,
1519+
DISABLED_BY_DISCORD = 3,
1520+
}
1521+
1522+
export const ApplicationEventWebhookEventTypes = [
1523+
"APPLICATION_AUTHORIZED",
1524+
"ENTITLEMENT_CREATE",
1525+
"QUEST_USER_ENROLLMENT"
1526+
] as const;
1527+
export type ApplicationEventWebhookEventType = typeof ApplicationEventWebhookEventTypes[number];
1528+
15161529
// entries are intentionally not aligned
15171530
/** The error codes that can be received. See [Discord's Documentation](https://discord.com/developers/docs/topics/opcodes-and-status-codes#json). */
15181531
export enum JSONErrorCodes {

lib/routes/Applications.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -285,6 +285,9 @@ export default class Applications {
285285
cover_image: options.coverImage,
286286
custom_install_url: options.customInstallURL,
287287
description: options.description,
288+
event_webhooks_status: options.eventWebhooksStatus,
289+
event_webhooks_types: options.eventWebhooksTypes,
290+
event_webhooks_url: options.eventWebhooksURL,
288291
flags: options.flags,
289292
icon: options.icon,
290293
install_params: options.installParams,

lib/structures/Application.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ import type Client from "../Client";
77
import type { InstallParams } from "../types/oauth";
88
import type {
99
ApplicationDiscoverabilityState,
10+
ApplicationEventWebhookEventType,
11+
ApplicationEventWebhookStatus,
1012
ApplicationExplicitContentFilterLevel,
1113
ApplicationIntegrationTypes,
1214
ApplicationMonetizationState,
@@ -39,6 +41,12 @@ export default class Application extends ClientApplication {
3941
discoverabilityState?: ApplicationDiscoverabilityState;
4042
/** The { @link Constants~ApplicationDiscoveryEligibilityFlags | flags } for this application's discovery eligibility. */
4143
discoveryEligibilityFlags?: number;
44+
/** If webhook events are enabled for the app. */
45+
eventWebhooksStatus: ApplicationEventWebhookStatus;
46+
/** List of Webhook event types the app subscribes to. */
47+
eventWebhooksTypes?: Array<ApplicationEventWebhookEventType>;
48+
/** Event webhooks URL for the app to receive webhook events. */
49+
eventWebhooksURL?: string | null;
4250
/** The explicit content filter for this application. */
4351
explicitContentFilter?: ApplicationExplicitContentFilterLevel;
4452
/** If this application is a game sold on Discord, the guild to which it has been linked. This will only be present if recieved via {@link REST/Applications.getCurrent | `/applications/@me`}. */
@@ -108,6 +116,9 @@ export default class Application extends ClientApplication {
108116
this.description = data.description;
109117
this.discoverabilityState = data.discoverability_state;
110118
this.discoveryEligibilityFlags = data.discovery_eligibility_flags;
119+
this.eventWebhooksStatus = data.event_webhooks_status;
120+
this.eventWebhooksTypes = data.event_webhooks_types;
121+
this.eventWebhooksURL = data.event_webhooks_url;
111122
this.explicitContentFilter = data.explicit_content_filter;
112123
this.guild = data.guild === undefined ? null : new OAuthGuild(data.guild, client);
113124
this.guildID = data.guild_id ?? null;

lib/types/applications.d.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ import type {
88
ApplicationCommandPermissionTypes,
99
ApplicationCommandTypes,
1010
ApplicationDiscoverabilityState,
11+
ApplicationEventWebhookEventType,
12+
ApplicationEventWebhookStatus,
1113
ApplicationExplicitContentFilterLevel,
1214
ApplicationIntegrationTypes,
1315
ApplicationMonetizationState,
@@ -37,6 +39,9 @@ export interface RawApplication {
3739
description: string;
3840
discoverability_state?: ApplicationDiscoverabilityState;
3941
discovery_eligibility_flags?: number;
42+
event_webhooks_status: ApplicationEventWebhookStatus;
43+
event_webhooks_types?: Array<ApplicationEventWebhookEventType>;
44+
event_webhooks_url?: string | null;
4045
explicit_content_filter?: ApplicationExplicitContentFilterLevel;
4146
flags?: number;
4247
guild?: RawOAuthGuild;
@@ -462,6 +467,9 @@ export interface EditApplicationOptions {
462467
customInstallURL?: string;
463468
/** The description of the application. */
464469
description?: string;
470+
eventWebhooksStatus?: Exclude<ApplicationEventWebhookStatus, ApplicationEventWebhookStatus.DISABLED_BY_DISCORD>;
471+
eventWebhooksTypes?: Array<ApplicationEventWebhookEventType>;
472+
eventWebhooksURL?: string | null;
465473
/** The [public flags](https://discord.com/developers/docs/resources/application#application-object-application-flags) of the application. */
466474
flags?: number;
467475
/** The icon for the application. */

0 commit comments

Comments
 (0)