From 1479e40bcecc4c28ecb9f05fa4fbbdfe3bd387e1 Mon Sep 17 00:00:00 2001 From: Jan <66554238+vaporox@users.noreply.github.com> Date: Tue, 11 Jan 2022 22:03:17 +0100 Subject: [PATCH] refactor(application): remove fetchAssets (#7250) --- .../src/structures/interfaces/Application.js | 25 +------------------ packages/discord.js/src/util/Constants.js | 5 ---- packages/discord.js/typings/index.d.ts | 13 ---------- packages/discord.js/typings/index.test-d.ts | 1 - 4 files changed, 1 insertion(+), 43 deletions(-) diff --git a/packages/discord.js/src/structures/interfaces/Application.js b/packages/discord.js/src/structures/interfaces/Application.js index e814c8768..5d29d165f 100644 --- a/packages/discord.js/src/structures/interfaces/Application.js +++ b/packages/discord.js/src/structures/interfaces/Application.js @@ -1,11 +1,9 @@ 'use strict'; const { DiscordSnowflake } = require('@sapphire/snowflake'); -const { ClientApplicationAssetTypes, Endpoints } = require('../../util/Constants'); +const { Endpoints } = require('../../util/Constants'); const Base = require('../Base'); -const AssetTypes = Object.keys(ClientApplicationAssetTypes); - /** * Represents an OAuth2 Application. * @abstract @@ -92,27 +90,6 @@ class Application extends Base { return Endpoints.CDN(this.client.options.http.cdn).AppIcon(this.id, this.cover, { format, size }); } - /** - * Asset data. - * @typedef {Object} ApplicationAsset - * @property {Snowflake} id The asset's id - * @property {string} name The asset's name - * @property {string} type The asset's type - */ - - /** - * Gets the application's rich presence assets. - * @returns {Promise>} - */ - async fetchAssets() { - const assets = await this.client.api.oauth2.applications(this.id).assets.get(); - return assets.map(a => ({ - id: a.id, - name: a.name, - type: AssetTypes[a.type - 1], - })); - } - /** * When concatenated with a string, this automatically returns the application's name instead of the * Application object. diff --git a/packages/discord.js/src/util/Constants.js b/packages/discord.js/src/util/Constants.js index 740d2ff95..737582976 100644 --- a/packages/discord.js/src/util/Constants.js +++ b/packages/discord.js/src/util/Constants.js @@ -573,11 +573,6 @@ exports.ThreadChannelTypes = ['GUILD_NEWS_THREAD', 'GUILD_PUBLIC_THREAD', 'GUILD */ exports.VoiceBasedChannelTypes = ['GUILD_VOICE', 'GUILD_STAGE_VOICE']; -exports.ClientApplicationAssetTypes = { - SMALL: 1, - BIG: 2, -}; - exports.Colors = { DEFAULT: 0x000000, WHITE: 0xffffff, diff --git a/packages/discord.js/typings/index.d.ts b/packages/discord.js/typings/index.d.ts index 6989a17dc..0b2aeedf5 100644 --- a/packages/discord.js/typings/index.d.ts +++ b/packages/discord.js/typings/index.d.ts @@ -200,7 +200,6 @@ export abstract class Application extends Base { public id: Snowflake; public name: string | null; public coverURL(options?: StaticImageURLOptions): string | null; - public fetchAssets(): Promise; public iconURL(options?: StaticImageURLOptions): string | null; public toJSON(): unknown; public toString(): string | null; @@ -2776,7 +2775,6 @@ export const Constants: { ThreadChannelTypes: ThreadChannelTypes[]; TextBasedChannelTypes: TextBasedChannelTypes[]; VoiceBasedChannelTypes: VoiceBasedChannelTypes[]; - ClientApplicationAssetTypes: ConstantsClientApplicationAssetTypes; IntegrationExpireBehaviors: IntegrationExpireBehaviors[]; InviteScopes: InviteScope[]; MessageTypes: MessageType[]; @@ -3502,12 +3500,6 @@ export interface APIRequest { route: string; } -export interface ApplicationAsset { - name: string; - id: Snowflake; - type: 'BIG' | 'SMALL'; -} - export interface BaseApplicationCommandData { name: string; defaultPermission?: boolean; @@ -4067,11 +4059,6 @@ export interface CommandInteractionResolvedData>; } -export interface ConstantsClientApplicationAssetTypes { - SMALL: 1; - BIG: 2; -} - export interface ConstantsColors { DEFAULT: 0x000000; WHITE: 0xffffff; diff --git a/packages/discord.js/typings/index.test-d.ts b/packages/discord.js/typings/index.test-d.ts index 62ac52cf2..fbca0337a 100644 --- a/packages/discord.js/typings/index.test-d.ts +++ b/packages/discord.js/typings/index.test-d.ts @@ -809,7 +809,6 @@ expectType<'messageCreate'>(Constants.Events.MESSAGE_CREATE); expectType<'close'>(Constants.ShardEvents.CLOSE); expectType<1>(Constants.Status.CONNECTING); expectType<0>(Constants.Opcodes.DISPATCH); -expectType<2>(Constants.ClientApplicationAssetTypes.BIG); declare const applicationCommandData: ApplicationCommandData; declare const applicationCommandResolvable: ApplicationCommandResolvable;