Skip to content

Commit e857cd3

Browse files
committed
fix(Embed): address equals method issue
1 parent efa3cac commit e857cd3

File tree

1 file changed

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

1 file changed

+23
-2
lines changed

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

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -211,9 +211,30 @@ class Embed {
211211
*/
212212
equals(other) {
213213
if (other instanceof Embed) {
214-
return isEqual(other.data, this.data);
214+
return isEqual(this.data, other.data);
215215
}
216-
return isEqual(other, this.data);
216+
217+
return (
218+
this.color === (other.color ?? null) &&
219+
this.description === (other.description ?? null) &&
220+
this.title === (other.title ?? null) &&
221+
this.url === (other.url ?? null) &&
222+
(this.timestamp ? new Date(this.timestamp).getTime() : null) ===
223+
(other.timestamp ? new Date(other.timestamp).getTime() : null) &&
224+
this.image?.url === other.image?.url &&
225+
this.thumbnail?.url === other.thumbnail?.url &&
226+
this.video?.url === other.video?.url &&
227+
isEqual(this.fields, other.fields?.map(field => ({ ...field, inline: field.inline ?? false })) ?? []) &&
228+
isEqual(this.provider, other.provider ?? null) &&
229+
isEqual(
230+
{ icon_url: this.author?.iconURL, name: this.author?.name, url: this.author?.url },
231+
{ icon_url: other.author?.icon_url, name: other.author?.name, url: other.author?.url },
232+
) &&
233+
isEqual(
234+
{ icon_url: this.footer?.iconURL, text: this.footer?.text },
235+
{ icon_url: other.footer?.icon_url, text: other.footer?.text },
236+
)
237+
);
217238
}
218239
}
219240

0 commit comments

Comments
 (0)