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

This commit is contained in:
Almeida
2022-10-12 10:39:28 +01:00
committed by GitHub
parent d7a45a0567
commit cb3826ce6d

View File

@@ -1,5 +1,6 @@
'use strict';
const { embedLength } = require('@discordjs/builders');
const isEqual = require('fast-deep-equal');
/**
@@ -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);
}
/**