Skip to content

Commit 34b6a82

Browse files
authored
refactor(IntegrationApplication): move common properties to Application (#10627)
* refactor(IntegrationApplication): move common properties to Application * fix: remove prop from ClientApplication
1 parent 6314d96 commit 34b6a82

File tree

3 files changed

+55
-22
lines changed

3 files changed

+55
-22
lines changed

packages/discord.js/src/structures/ClientApplication.js

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -173,26 +173,6 @@ class ClientApplication extends Application {
173173
this.guildId ??= null;
174174
}
175175

176-
if ('cover_image' in data) {
177-
/**
178-
* The hash of the application's cover image
179-
* @type {?string}
180-
*/
181-
this.cover = data.cover_image;
182-
} else {
183-
this.cover ??= null;
184-
}
185-
186-
if ('rpc_origins' in data) {
187-
/**
188-
* The application's RPC origins, if enabled
189-
* @type {string[]}
190-
*/
191-
this.rpcOrigins = data.rpc_origins;
192-
} else {
193-
this.rpcOrigins ??= [];
194-
}
195-
196176
if ('bot_require_code_grant' in data) {
197177
/**
198178
* If this application's bot requires a code grant when using the OAuth2 flow

packages/discord.js/src/structures/interfaces/Application.js

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,56 @@ class Application extends Base {
5050
} else {
5151
this.icon ??= null;
5252
}
53+
54+
if ('terms_of_service_url' in data) {
55+
/**
56+
* The URL of the application's terms of service
57+
* @type {?string}
58+
*/
59+
this.termsOfServiceURL = data.terms_of_service_url;
60+
} else {
61+
this.termsOfServiceURL ??= null;
62+
}
63+
64+
if ('privacy_policy_url' in data) {
65+
/**
66+
* The URL of the application's privacy policy
67+
* @type {?string}
68+
*/
69+
this.privacyPolicyURL = data.privacy_policy_url;
70+
} else {
71+
this.privacyPolicyURL ??= null;
72+
}
73+
74+
if ('rpc_origins' in data) {
75+
/**
76+
* The application's RPC origins, if enabled
77+
* @type {string[]}
78+
*/
79+
this.rpcOrigins = data.rpc_origins;
80+
} else {
81+
this.rpcOrigins ??= [];
82+
}
83+
84+
if ('cover_image' in data) {
85+
/**
86+
* The hash of the application's cover image
87+
* @type {?string}
88+
*/
89+
this.cover = data.cover_image;
90+
} else {
91+
this.cover ??= null;
92+
}
93+
94+
if ('verify_key' in data) {
95+
/**
96+
* The hex-encoded key for verification in interactions and the GameSDK's GetTicket
97+
* @type {?string}
98+
*/
99+
this.verifyKey = data.verify_key;
100+
} else {
101+
this.verifyKey ??= null;
102+
}
53103
}
54104

55105
/**

packages/discord.js/typings/index.d.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -413,6 +413,11 @@ export abstract class Application extends Base {
413413
public icon: string | null;
414414
public id: Snowflake;
415415
public name: string | null;
416+
public termsOfServiceURL: string | null;
417+
public privacyPolicyURL: string | null;
418+
public rpcOrigins: string[];
419+
public cover: string | null;
420+
public verifyKey: string | null;
416421
public coverURL(options?: ImageURLOptions): string | null;
417422
public iconURL(options?: ImageURLOptions): string | null;
418423
public toJSON(): unknown;
@@ -1060,7 +1065,6 @@ export class ClientApplication extends Application {
10601065
public subscriptions: SubscriptionManager;
10611066
public guildId: Snowflake | null;
10621067
public get guild(): Guild | null;
1063-
public cover: string | null;
10641068
public flags: Readonly<ApplicationFlagsBitField>;
10651069
public approximateGuildCount: number | null;
10661070
public approximateUserInstallCount: number | null;
@@ -1075,7 +1079,6 @@ export class ClientApplication extends Application {
10751079
public eventWebhooksStatus: ApplicationWebhookEventStatus | null;
10761080
public eventWebhooksTypes: ApplicationWebhookEventType[] | null;
10771081
public roleConnectionsVerificationURL: string | null;
1078-
public rpcOrigins: string[];
10791082
public edit(options: ClientApplicationEditOptions): Promise<ClientApplication>;
10801083
public fetch(): Promise<ClientApplication>;
10811084
public fetchRoleConnectionMetadataRecords(): Promise<ApplicationRoleConnectionMetadata[]>;

0 commit comments

Comments
 (0)