Skip to content

Commit 6965063

Browse files
committed
refactor(IntegrationApplication): move common properties to Application
1 parent 2b0944a commit 6965063

File tree

4 files changed

+55
-75
lines changed

4 files changed

+55
-75
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/IntegrationApplication.js

Lines changed: 0 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -20,36 +20,6 @@ class IntegrationApplication extends Application {
2020
this.bot ??= null;
2121
}
2222

23-
if ('terms_of_service_url' in data) {
24-
/**
25-
* The URL of the application's terms of service
26-
* @type {?string}
27-
*/
28-
this.termsOfServiceURL = data.terms_of_service_url;
29-
} else {
30-
this.termsOfServiceURL ??= null;
31-
}
32-
33-
if ('privacy_policy_url' in data) {
34-
/**
35-
* The URL of the application's privacy policy
36-
* @type {?string}
37-
*/
38-
this.privacyPolicyURL = data.privacy_policy_url;
39-
} else {
40-
this.privacyPolicyURL ??= null;
41-
}
42-
43-
if ('rpc_origins' in data) {
44-
/**
45-
* The Array of RPC origin URLs
46-
* @type {string[]}
47-
*/
48-
this.rpcOrigins = data.rpc_origins;
49-
} else {
50-
this.rpcOrigins ??= [];
51-
}
52-
5323
if ('hook' in data) {
5424
/**
5525
* Whether the application can be default hooked by the client
@@ -59,26 +29,6 @@ class IntegrationApplication extends Application {
5929
} else {
6030
this.hook ??= null;
6131
}
62-
63-
if ('cover_image' in data) {
64-
/**
65-
* The hash of the application's cover image
66-
* @type {?string}
67-
*/
68-
this.cover = data.cover_image;
69-
} else {
70-
this.cover ??= null;
71-
}
72-
73-
if ('verify_key' in data) {
74-
/**
75-
* The hex-encoded key for verification in interactions and the GameSDK's GetTicket
76-
* @type {?string}
77-
*/
78-
this.verifyKey = data.verify_key;
79-
} else {
80-
this.verifyKey ??= null;
81-
}
8232
}
8333
}
8434

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 & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -412,6 +412,11 @@ export abstract class Application extends Base {
412412
public icon: string | null;
413413
public id: Snowflake;
414414
public name: string | null;
415+
public termsOfServiceURL: string | null;
416+
public privacyPolicyURL: string | null;
417+
public rpcOrigins: string[];
418+
public cover: string | null;
419+
public verifyKey: string | null;
415420
public coverURL(options?: ImageURLOptions): string | null;
416421
public iconURL(options?: ImageURLOptions): string | null;
417422
public toJSON(): unknown;
@@ -1899,12 +1904,7 @@ export class Integration extends Base {
18991904
export class IntegrationApplication extends Application {
19001905
private constructor(client: Client<true>, data: RawIntegrationApplicationData);
19011906
public bot: User | null;
1902-
public termsOfServiceURL: string | null;
1903-
public privacyPolicyURL: string | null;
1904-
public rpcOrigins: string[];
19051907
public hook: boolean | null;
1906-
public cover: string | null;
1907-
public verifyKey: string | null;
19081908
}
19091909

19101910
export type GatewayIntentsString = keyof typeof GatewayIntentBits;

0 commit comments

Comments
 (0)