mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-17 03:53:29 +01:00
refactor(Embed): use embedLength function from builders (#8735)
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
const { embedLength } = require('@discordjs/builders');
|
||||||
const isEqual = require('fast-deep-equal');
|
const isEqual = require('fast-deep-equal');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -181,13 +182,7 @@ class Embed {
|
|||||||
* @readonly
|
* @readonly
|
||||||
*/
|
*/
|
||||||
get length() {
|
get length() {
|
||||||
return (
|
return embedLength(this.data);
|
||||||
(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)
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user