From 1eca6f53528e864091478e3bd45f4a6048db125c Mon Sep 17 00:00:00 2001 From: Jiralite <33201955+Jiralite@users.noreply.github.com> Date: Tue, 12 Apr 2022 22:25:50 +0100 Subject: [PATCH 1/5] refactor: deprecate splitting --- src/util/Util.js | 11 +++++++++++ typings/index.d.ts | 1 + 2 files changed, 12 insertions(+) diff --git a/src/util/Util.js b/src/util/Util.js index 7901f7781ad8..7e7e8f398066 100644 --- a/src/util/Util.js +++ b/src/util/Util.js @@ -10,6 +10,7 @@ const { Error: DiscordError, RangeError, TypeError } = require('../errors'); const has = (o, k) => Object.prototype.hasOwnProperty.call(o, k); const isObject = d => typeof d === 'object' && d !== null; +let deprecationEmittedForSplitMessage = false; let deprecationEmittedForRemoveMentions = false; /** @@ -70,9 +71,19 @@ class Util extends null { * Splits a string into multiple chunks at a designated character that do not exceed a specific length. * @param {string} text Content to split * @param {SplitOptions} [options] Options controlling the behavior of the split + * @deprecated This will be removed in the next major version. * @returns {string[]} */ static splitMessage(text, { maxLength = 2_000, char = '\n', prepend = '', append = '' } = {}) { + if (!deprecationEmittedForSplitMessage) { + process.emitWarning( + 'The Util.splitMessage method is deprecated and will be removed in the next major version.', + 'DeprecationWarning', + ); + + deprecationEmittedForSplitMessage = true; + } + text = Util.verifyString(text); if (text.length <= maxLength) return [text]; let splitText = [text]; diff --git a/typings/index.d.ts b/typings/index.d.ts index 45d31db79dfb..da83b4f410d4 100644 --- a/typings/index.d.ts +++ b/typings/index.d.ts @@ -2609,6 +2609,7 @@ export class Util extends null { route: unknown, reason?: string, ): Promise<{ id: Snowflake; position: number }[]>; + /** @deprecated This will be removed in the next major version. */ public static splitMessage(text: string, options?: SplitOptions): string[]; } From 608c9fe8057a45dc61d351b9b48ecec4321c5d9a Mon Sep 17 00:00:00 2001 From: Jiralite <33201955+Jiralite@users.noreply.github.com> Date: Tue, 12 Apr 2022 22:57:26 +0100 Subject: [PATCH 2/5] refactor: deprecate `IntegrationApplication#summary` https://github.com/discordjs/discord.js/pull/7729 --- src/structures/IntegrationApplication.js | 1 + typings/index.d.ts | 1 + 2 files changed, 2 insertions(+) diff --git a/src/structures/IntegrationApplication.js b/src/structures/IntegrationApplication.js index 1a81df1f0173..61cb199e258b 100644 --- a/src/structures/IntegrationApplication.js +++ b/src/structures/IntegrationApplication.js @@ -54,6 +54,7 @@ class IntegrationApplication extends Application { /** * The application's summary * @type {?string} + * @deprecated This property is no longer being sent by the API. */ this.summary = data.summary; } else { diff --git a/typings/index.d.ts b/typings/index.d.ts index da83b4f410d4..56c84ffff6fd 100644 --- a/typings/index.d.ts +++ b/typings/index.d.ts @@ -1314,6 +1314,7 @@ export class IntegrationApplication extends Application { public termsOfServiceURL: string | null; public privacyPolicyURL: string | null; public rpcOrigins: string[]; + /** @deprecated This property is no longer being sent by the API. */ public summary: string | null; public hook: boolean | null; public cover: string | null; From 5705f213c285121dee91a6d80bdd1579069a2620 Mon Sep 17 00:00:00 2001 From: Jiralite <33201955+Jiralite@users.noreply.github.com> Date: Wed, 13 Apr 2022 00:11:35 +0100 Subject: [PATCH 3/5] docs: amend store channel wording --- src/structures/StoreChannel.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/structures/StoreChannel.js b/src/structures/StoreChannel.js index e8bd745fdc8c..3db1e40c2bbd 100644 --- a/src/structures/StoreChannel.js +++ b/src/structures/StoreChannel.js @@ -4,7 +4,7 @@ const GuildChannel = require('./GuildChannel'); /** * Represents a guild store channel on Discord. - * Store channels are deprecated and will be removed from Discord in March 2022. See + * Store channels have been removed from Discord. See * [Self-serve Game Selling Deprecation](https://support-dev.discord.com/hc/en-us/articles/4414590563479) * for more information. * @extends {GuildChannel} From c9ceeda87c5171796bb11f3d7136d3f067a02459 Mon Sep 17 00:00:00 2001 From: Jiralite <33201955+Jiralite@users.noreply.github.com> Date: Wed, 13 Apr 2022 01:41:22 +0100 Subject: [PATCH 4/5] refactor: deprecate fetching of application assets --- src/structures/interfaces/Application.js | 13 +++++++++++++ typings/index.d.ts | 1 + 2 files changed, 14 insertions(+) diff --git a/src/structures/interfaces/Application.js b/src/structures/interfaces/Application.js index bc3b09c0052e..2334bdaa698d 100644 --- a/src/structures/interfaces/Application.js +++ b/src/structures/interfaces/Application.js @@ -1,11 +1,14 @@ 'use strict'; +const process = require('node:process'); const { ClientApplicationAssetTypes, Endpoints } = require('../../util/Constants'); const SnowflakeUtil = require('../../util/SnowflakeUtil'); const Base = require('../Base'); const AssetTypes = Object.keys(ClientApplicationAssetTypes); +let deprecationEmittedForFetchAssets = false; + /** * Represents an OAuth2 Application. * @abstract @@ -103,8 +106,18 @@ class Application extends Base { /** * Gets the application's rich presence assets. * @returns {Promise>} + * @deprecated This will be removed in the next major as it is unsupported functionality. */ async fetchAssets() { + if (!deprecationEmittedForFetchAssets) { + process.emitWarning( + 'Application#fetchAssets is deprecated as it is unsupported and will be removed in the next major version.', + 'DeprecationWarning', + ); + + deprecationEmittedForFetchAssets = true; + } + const assets = await this.client.api.oauth2.applications(this.id).assets.get(); return assets.map(a => ({ id: a.id, diff --git a/typings/index.d.ts b/typings/index.d.ts index 56c84ffff6fd..bcd4891768f6 100644 --- a/typings/index.d.ts +++ b/typings/index.d.ts @@ -209,6 +209,7 @@ export abstract class Application extends Base { public id: Snowflake; public name: string | null; public coverURL(options?: StaticImageURLOptions): string | null; + /** @deprecated This method is deprecated as it is unsupported and will be removed in the next major version. */ public fetchAssets(): Promise; public iconURL(options?: StaticImageURLOptions): string | null; public toJSON(): unknown; From 0bca63b5be672ebba8320f8950407676fc3b10a2 Mon Sep 17 00:00:00 2001 From: Jiralite <33201955+Jiralite@users.noreply.github.com> Date: Wed, 13 Apr 2022 01:45:26 +0100 Subject: [PATCH 5/5] docs: deprecate vip field in voice regions --- src/structures/VoiceRegion.js | 1 + typings/index.d.ts | 1 + 2 files changed, 2 insertions(+) diff --git a/src/structures/VoiceRegion.js b/src/structures/VoiceRegion.js index fe399b49d24e..7cf6c881aff8 100644 --- a/src/structures/VoiceRegion.js +++ b/src/structures/VoiceRegion.js @@ -22,6 +22,7 @@ class VoiceRegion { /** * Whether the region is VIP-only * @type {boolean} + * @deprecated This property is no longer being sent by the API. */ this.vip = data.vip; diff --git a/typings/index.d.ts b/typings/index.d.ts index bcd4891768f6..b2f0d27f6fd8 100644 --- a/typings/index.d.ts +++ b/typings/index.d.ts @@ -2653,6 +2653,7 @@ export class VoiceRegion { public id: string; public name: string; public optimal: boolean; + /** @deprecated This property is no longer being sent by the API. */ public vip: boolean; public toJSON(): unknown; }