fix(ClientApplication): Message#application is a partial ClientApplication

This commit is contained in:
SpaceEEC
2018-08-22 19:26:57 +02:00
parent 28d4f74b65
commit 82993fbe51
2 changed files with 10 additions and 10 deletions

View File

@@ -47,27 +47,27 @@ class ClientApplication extends Base {
/** /**
* The app's RPC origins, if enabled * The app's RPC origins, if enabled
* @type {?string[]} * @type {string[]}
*/ */
this.rpcOrigins = data.rpc_origins || []; this.rpcOrigins = data.rpc_origins || [];
/** /**
* If this app's bot requires a code grant when using the OAuth2 flow * If this app's bot requires a code grant when using the OAuth2 flow
* @type {boolean} * @type {?boolean}
*/ */
this.botRequireCodeGrant = data.bot_require_code_grant; this.botRequireCodeGrant = typeof data.bot_require_code_grant !== 'undefined' ? data.bot_require_code_grant : null;
/** /**
* If this app's bot is public * If this app's bot is public
* @type {boolean} * @type {?boolean}
*/ */
this.botPublic = data.bot_public; this.botPublic = typeof data.bot_public !== 'undefined' ? data.bot_public : null;
/** /**
* The owner of this OAuth application * The owner of this OAuth application
* @type {User} * @type {?User}
*/ */
this.owner = this.client.users.add(data.owner); this.owner = data.owner ? this.client.users.add(data.owner) : null;
} }
/** /**

6
typings/index.d.ts vendored
View File

@@ -228,8 +228,8 @@ declare module 'discord.js' {
export class ClientApplication extends Base { export class ClientApplication extends Base {
constructor(client: Client, data: object); constructor(client: Client, data: object);
public botPublic: boolean; public botPublic?: boolean;
public botRequireCodeGrant: boolean; public botRequireCodeGrant?: boolean;
public cover?: string; public cover?: string;
public readonly createdAt: Date; public readonly createdAt: Date;
public readonly createdTimestamp: number; public readonly createdTimestamp: number;
@@ -237,7 +237,7 @@ declare module 'discord.js' {
public icon: string; public icon: string;
public id: Snowflake; public id: Snowflake;
public name: string; public name: string;
public owner: User; public owner?: User;
public rpcOrigins: string[]; public rpcOrigins: string[];
public coverImage(options?: AvatarOptions): string; public coverImage(options?: AvatarOptions): string;
public fetchAssets(): Promise<ClientApplicationAsset>; public fetchAssets(): Promise<ClientApplicationAsset>;