Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(MessageEmbed): include author.name in length getter #5167

Merged
merged 4 commits into from Dec 31, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 5 additions & 4 deletions src/structures/MessageEmbed.js
Expand Up @@ -231,18 +231,19 @@ 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
*/
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) +
(this.footer ? this.footer.text.length : 0)
(this.footer?.text.length ?? 0) +
(this.author?.name.length ?? 0)
xiBread marked this conversation as resolved.
Show resolved Hide resolved
);
}

Expand Down