From 49b94004141fdb0e543423326a94d947018e86bd Mon Sep 17 00:00:00 2001 From: Oscar Lee-Vermeren Date: Wed, 30 Dec 2020 23:10:13 -0500 Subject: [PATCH 1/4] fix(MessageEmbed): include `author.name` in length getter --- src/structures/MessageEmbed.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/structures/MessageEmbed.js b/src/structures/MessageEmbed.js index ef007a551cec..0ed45a804508 100644 --- a/src/structures/MessageEmbed.js +++ b/src/structures/MessageEmbed.js @@ -231,7 +231,7 @@ class MessageEmbed { } /** - * The accumulated length for the embed title, description, fields and footer text + * The accumulated length for the embed title, description, fields, footer text and author name * @type {number} * @readonly */ @@ -242,7 +242,8 @@ class MessageEmbed { (this.fields.length >= 1 ? this.fields.reduce((prev, curr) => prev + curr.name.length + curr.value.length, 0) : 0) + - (this.footer ? this.footer.text.length : 0) + (this.footer ? this.footer.text.length : 0) + + (this.author ? this.author.name.length : 0) ); } From 65b7f7bae57db954273f3935ce60845933f44e83 Mon Sep 17 00:00:00 2001 From: Bread <60681223+vBread@users.noreply.github.com> Date: Thu, 31 Dec 2020 01:55:43 -0500 Subject: [PATCH 2/4] Update src/structures/MessageEmbed.js Co-authored-by: Papaia <43409674+papaia@users.noreply.github.com> --- src/structures/MessageEmbed.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/structures/MessageEmbed.js b/src/structures/MessageEmbed.js index 0ed45a804508..498a244d1f60 100644 --- a/src/structures/MessageEmbed.js +++ b/src/structures/MessageEmbed.js @@ -242,8 +242,8 @@ class MessageEmbed { (this.fields.length >= 1 ? this.fields.reduce((prev, curr) => prev + curr.name.length + curr.value.length, 0) : 0) + - (this.footer ? this.footer.text.length : 0) + - (this.author ? this.author.name.length : 0) + (this.footer?.text.length ?? 0) + + (this.author?.name.length ?? 0) ); } From 43c4fb093a45c3e8e9bb46849e2e7357fa2327cb Mon Sep 17 00:00:00 2001 From: Bread <60681223+vBread@users.noreply.github.com> Date: Thu, 31 Dec 2020 01:57:59 -0500 Subject: [PATCH 3/4] style: oxford comma Co-authored-by: Papaia <43409674+papaia@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 498a244d1f60..8f016a624189 100644 --- a/src/structures/MessageEmbed.js +++ b/src/structures/MessageEmbed.js @@ -231,7 +231,7 @@ class MessageEmbed { } /** - * The accumulated length for the embed title, description, fields, footer text and author name + * The accumulated length for the embed title, description, fields, footer text, and author name * @type {number} * @readonly */ From 003d7e962503d562a0060084af623c57484d49c5 Mon Sep 17 00:00:00 2001 From: Oscar Lee-Vermeren Date: Thu, 31 Dec 2020 14:17:45 -0500 Subject: [PATCH 4/4] refactor: es2020 syntax --- src/structures/MessageEmbed.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/structures/MessageEmbed.js b/src/structures/MessageEmbed.js index 8f016a624189..8d9dce92b0aa 100644 --- a/src/structures/MessageEmbed.js +++ b/src/structures/MessageEmbed.js @@ -237,8 +237,8 @@ class MessageEmbed { */ get length() { return ( - (this.title ? this.title.length : 0) + - (this.description ? this.description.length : 0) + + (this.title?.length ?? 0) + + (this.description?.length ?? 0) + (this.fields.length >= 1 ? this.fields.reduce((prev, curr) => prev + curr.name.length + curr.value.length, 0) : 0) +