Skip to content

Commit cb3826c

Browse files
authored
refactor(Embed): use embedLength function from builders (#8735)
1 parent d7a45a0 commit cb3826c

File tree

1 file changed

+2
-7
lines changed
  • packages/discord.js/src/structures

1 file changed

+2
-7
lines changed

packages/discord.js/src/structures/Embed.js

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
'use strict';
22

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

56
/**
@@ -181,13 +182,7 @@ class Embed {
181182
* @readonly
182183
*/
183184
get length() {
184-
return (
185-
(this.data.title?.length ?? 0) +
186-
(this.data.description?.length ?? 0) +
187-
(this.data.fields?.reduce((prev, curr) => prev + curr.name.length + curr.value.length, 0) ?? 0) +
188-
(this.data.footer?.text.length ?? 0) +
189-
(this.data.author?.name.length ?? 0)
190-
);
185+
return embedLength(this.data);
191186
}
192187

193188
/**

0 commit comments

Comments
 (0)