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

refactor(Embed): use embedLength function from builders #8735

Merged
merged 1 commit into from Oct 12, 2022
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: 2 additions & 7 deletions packages/discord.js/src/structures/Embed.js
@@ -1,5 +1,6 @@
'use strict';

const { embedLength } = require('@discordjs/builders');
const isEqual = require('fast-deep-equal');

/**
Expand Down Expand Up @@ -181,13 +182,7 @@ class Embed {
* @readonly
*/
get length() {
return (
(this.data.title?.length ?? 0) +
(this.data.description?.length ?? 0) +
(this.data.fields?.reduce((prev, curr) => prev + curr.name.length + curr.value.length, 0) ?? 0) +
(this.data.footer?.text.length ?? 0) +
(this.data.author?.name.length ?? 0)
);
return embedLength(this.data);
iCrawl marked this conversation as resolved.
Show resolved Hide resolved
}

/**
Expand Down