From 84ac88cd7380f57bb1c679ce0870f312498510de Mon Sep 17 00:00:00 2001 From: nyapat <73502164+nyapat@users.noreply.github.com> Date: Mon, 18 Jul 2022 16:14:33 -0500 Subject: [PATCH 1/7] refactor(embed): deprecate addField --- src/structures/MessageEmbed.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/structures/MessageEmbed.js b/src/structures/MessageEmbed.js index 02367fd85cbc..0b328142397c 100644 --- a/src/structures/MessageEmbed.js +++ b/src/structures/MessageEmbed.js @@ -6,6 +6,7 @@ const Util = require('../util/Util'); let deprecationEmittedForSetAuthor = false; let deprecationEmittedForSetFooter = false; +let deprecationEmittedForAddField = false; // TODO: Remove the deprecated code for `setAuthor()` and `setFooter()`. @@ -314,8 +315,17 @@ class MessageEmbed { * @param {string} value The value of this field * @param {boolean} [inline=false] If this field will be displayed inline * @returns {MessageEmbed} + * @deprecated This method is a wrapper for {@link MessageEmbed#addFields}, use that instead. */ addField(name, value, inline) { + if (!deprecationEmittedForAddField) { + process.emitWarning( + 'MessageEmbed#addField is deprecated and removed in the next major. Use MessageEmbed#addFields instead.', + 'DeprecationWarning', + ); + + deprecationEmittedForAddField = true; + } return this.addFields({ name, value, inline }); } From d9844d927b2f617f69e766aa6e1265a1219eec22 Mon Sep 17 00:00:00 2001 From: nyapat <73502164+nyapat@users.noreply.github.com> Date: Mon, 18 Jul 2022 16:21:51 -0500 Subject: [PATCH 2/7] chore: jsdoc types properly --- src/structures/MessageEmbed.js | 2 +- typings/index.d.ts | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/structures/MessageEmbed.js b/src/structures/MessageEmbed.js index 0b328142397c..930a034fae3e 100644 --- a/src/structures/MessageEmbed.js +++ b/src/structures/MessageEmbed.js @@ -315,7 +315,7 @@ class MessageEmbed { * @param {string} value The value of this field * @param {boolean} [inline=false] If this field will be displayed inline * @returns {MessageEmbed} - * @deprecated This method is a wrapper for {@link MessageEmbed#addFields}, use that instead. + * @deprecated This method is a wrapper for {@link MessageEmbed.addFields}, use that instead. */ addField(name, value, inline) { if (!deprecationEmittedForAddField) { diff --git a/typings/index.d.ts b/typings/index.d.ts index 803b0928b582..c93e5fb325a6 100644 --- a/typings/index.d.ts +++ b/typings/index.d.ts @@ -1766,6 +1766,7 @@ export class MessageEmbed { public url: string | null; public readonly video: MessageEmbedVideo | null; public addField(name: string, value: string, inline?: boolean): this; + /** @deprecated This method is a wrapper for {@link MessageEmbed.addFields}, use that instead. */ public addFields(...fields: EmbedFieldData[] | EmbedFieldData[][]): this; public setFields(...fields: EmbedFieldData[] | EmbedFieldData[][]): this; public setAuthor(options: EmbedAuthorData | null): this; From ad72af095c3f59db96967aa00703a88b8b7c2e9c Mon Sep 17 00:00:00 2001 From: pat <73502164+nyapat@users.noreply.github.com> Date: Mon, 18 Jul 2022 16:38:41 -0500 Subject: [PATCH 3/7] Update src/structures/MessageEmbed.js Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com> --- src/structures/MessageEmbed.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/structures/MessageEmbed.js b/src/structures/MessageEmbed.js index 930a034fae3e..e78db363c95c 100644 --- a/src/structures/MessageEmbed.js +++ b/src/structures/MessageEmbed.js @@ -315,7 +315,7 @@ class MessageEmbed { * @param {string} value The value of this field * @param {boolean} [inline=false] If this field will be displayed inline * @returns {MessageEmbed} - * @deprecated This method is a wrapper for {@link MessageEmbed.addFields}, use that instead. + * @deprecated This method is a wrapper for {@link MessageEmbed#addFields}. Use that instead. */ addField(name, value, inline) { if (!deprecationEmittedForAddField) { From 4a80ccdb7b5946dada31be56d7d433753bdeec44 Mon Sep 17 00:00:00 2001 From: pat <73502164+nyapat@users.noreply.github.com> Date: Wed, 20 Jul 2022 19:08:14 -0500 Subject: [PATCH 4/7] Update src/structures/MessageEmbed.js Co-authored-by: Arjun Sharda <77706434+ArjunSharda@users.noreply.github.com> --- src/structures/MessageEmbed.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/structures/MessageEmbed.js b/src/structures/MessageEmbed.js index e78db363c95c..c1197a6ef540 100644 --- a/src/structures/MessageEmbed.js +++ b/src/structures/MessageEmbed.js @@ -320,7 +320,7 @@ class MessageEmbed { addField(name, value, inline) { if (!deprecationEmittedForAddField) { process.emitWarning( - 'MessageEmbed#addField is deprecated and removed in the next major. Use MessageEmbed#addFields instead.', + 'MessageEmbed#addField is deprecated and will be removed in the next major update. Use MessageEmbed#addFields instead.', 'DeprecationWarning', ); From 009c763f08a888caf5a19eb8d57c63e31621037b Mon Sep 17 00:00:00 2001 From: nyapat <73502164+nyapat@users.noreply.github.com> Date: Wed, 20 Jul 2022 19:16:00 -0500 Subject: [PATCH 5/7] style: disable max-len (ref #7080) --- src/structures/MessageEmbed.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/structures/MessageEmbed.js b/src/structures/MessageEmbed.js index c1197a6ef540..d8725552827c 100644 --- a/src/structures/MessageEmbed.js +++ b/src/structures/MessageEmbed.js @@ -320,6 +320,7 @@ class MessageEmbed { addField(name, value, inline) { if (!deprecationEmittedForAddField) { process.emitWarning( + // eslint-disable-next-line max-len 'MessageEmbed#addField is deprecated and will be removed in the next major update. Use MessageEmbed#addFields instead.', 'DeprecationWarning', ); From 64f07efc12e7c9b877ce6bba1b14026106b36fd0 Mon Sep 17 00:00:00 2001 From: nyapat <73502164+nyapat@users.noreply.github.com> Date: Wed, 20 Jul 2022 19:17:22 -0500 Subject: [PATCH 6/7] docs: update jsdoc in typings --- typings/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/typings/index.d.ts b/typings/index.d.ts index c93e5fb325a6..3e67e5005812 100644 --- a/typings/index.d.ts +++ b/typings/index.d.ts @@ -1766,7 +1766,7 @@ export class MessageEmbed { public url: string | null; public readonly video: MessageEmbedVideo | null; public addField(name: string, value: string, inline?: boolean): this; - /** @deprecated This method is a wrapper for {@link MessageEmbed.addFields}, use that instead. */ + /** @deprecated This method is a wrapper for {@link MessageEmbed#addFields}. Use that instead. */ public addFields(...fields: EmbedFieldData[] | EmbedFieldData[][]): this; public setFields(...fields: EmbedFieldData[] | EmbedFieldData[][]): this; public setAuthor(options: EmbedAuthorData | null): this; From c1b90846eb22835a3fcb9a50ea1e3d91de88fd25 Mon Sep 17 00:00:00 2001 From: pat <73502164+nyapat@users.noreply.github.com> Date: Thu, 21 Jul 2022 17:35:43 -0500 Subject: [PATCH 7/7] Update typings/index.d.ts Co-authored-by: Almeida --- typings/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/typings/index.d.ts b/typings/index.d.ts index 3e67e5005812..1aebe7dbec81 100644 --- a/typings/index.d.ts +++ b/typings/index.d.ts @@ -1765,8 +1765,8 @@ export class MessageEmbed { public type: string; public url: string | null; public readonly video: MessageEmbedVideo | null; - public addField(name: string, value: string, inline?: boolean): this; /** @deprecated This method is a wrapper for {@link MessageEmbed#addFields}. Use that instead. */ + public addField(name: string, value: string, inline?: boolean): this; public addFields(...fields: EmbedFieldData[] | EmbedFieldData[][]): this; public setFields(...fields: EmbedFieldData[] | EmbedFieldData[][]): this; public setAuthor(options: EmbedAuthorData | null): this;