Skip to content

Commit

Permalink
refactor(Embed): use embedLength function from builders (#8735)
Browse files Browse the repository at this point in the history
  • Loading branch information
almeidx committed Oct 12, 2022
1 parent d7a45a0 commit cb3826c
Showing 1 changed file with 2 additions and 7 deletions.
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);
}

/**
Expand Down

0 comments on commit cb3826c

Please sign in to comment.