Skip to content

Commit

Permalink
refactor(IntegrationApplication): move common properties to Applicati…
Browse files Browse the repository at this point in the history
…on (#10627)

* refactor(IntegrationApplication): move common properties to Application

* fix: remove prop from ClientApplication
  • Loading branch information
imnaiyar authored Jan 13, 2025
1 parent 6314d96 commit 34b6a82
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 22 deletions.
20 changes: 0 additions & 20 deletions packages/discord.js/src/structures/ClientApplication.js
Original file line number Diff line number Diff line change
Expand Up @@ -173,26 +173,6 @@ class ClientApplication extends Application {
this.guildId ??= null;
}

if ('cover_image' in data) {
/**
* The hash of the application's cover image
* @type {?string}
*/
this.cover = data.cover_image;
} else {
this.cover ??= null;
}

if ('rpc_origins' in data) {
/**
* The application's RPC origins, if enabled
* @type {string[]}
*/
this.rpcOrigins = data.rpc_origins;
} else {
this.rpcOrigins ??= [];
}

if ('bot_require_code_grant' in data) {
/**
* If this application's bot requires a code grant when using the OAuth2 flow
Expand Down
50 changes: 50 additions & 0 deletions packages/discord.js/src/structures/interfaces/Application.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,56 @@ class Application extends Base {
} else {
this.icon ??= null;
}

if ('terms_of_service_url' in data) {
/**
* The URL of the application's terms of service
* @type {?string}
*/
this.termsOfServiceURL = data.terms_of_service_url;
} else {
this.termsOfServiceURL ??= null;
}

if ('privacy_policy_url' in data) {
/**
* The URL of the application's privacy policy
* @type {?string}
*/
this.privacyPolicyURL = data.privacy_policy_url;
} else {
this.privacyPolicyURL ??= null;
}

if ('rpc_origins' in data) {
/**
* The application's RPC origins, if enabled
* @type {string[]}
*/
this.rpcOrigins = data.rpc_origins;
} else {
this.rpcOrigins ??= [];
}

if ('cover_image' in data) {
/**
* The hash of the application's cover image
* @type {?string}
*/
this.cover = data.cover_image;
} else {
this.cover ??= null;
}

if ('verify_key' in data) {
/**
* The hex-encoded key for verification in interactions and the GameSDK's GetTicket
* @type {?string}
*/
this.verifyKey = data.verify_key;
} else {
this.verifyKey ??= null;
}
}

/**
Expand Down
7 changes: 5 additions & 2 deletions packages/discord.js/typings/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -413,6 +413,11 @@ export abstract class Application extends Base {
public icon: string | null;
public id: Snowflake;
public name: string | null;
public termsOfServiceURL: string | null;
public privacyPolicyURL: string | null;
public rpcOrigins: string[];
public cover: string | null;
public verifyKey: string | null;
public coverURL(options?: ImageURLOptions): string | null;
public iconURL(options?: ImageURLOptions): string | null;
public toJSON(): unknown;
Expand Down Expand Up @@ -1060,7 +1065,6 @@ export class ClientApplication extends Application {
public subscriptions: SubscriptionManager;
public guildId: Snowflake | null;
public get guild(): Guild | null;
public cover: string | null;
public flags: Readonly<ApplicationFlagsBitField>;
public approximateGuildCount: number | null;
public approximateUserInstallCount: number | null;
Expand All @@ -1075,7 +1079,6 @@ export class ClientApplication extends Application {
public eventWebhooksStatus: ApplicationWebhookEventStatus | null;
public eventWebhooksTypes: ApplicationWebhookEventType[] | null;
public roleConnectionsVerificationURL: string | null;
public rpcOrigins: string[];
public edit(options: ClientApplicationEditOptions): Promise<ClientApplication>;
public fetch(): Promise<ClientApplication>;
public fetchRoleConnectionMetadataRecords(): Promise<ApplicationRoleConnectionMetadata[]>;
Expand Down

0 comments on commit 34b6a82

Please sign in to comment.