Skip to content

Commit ddc927f

Browse files
fix(Embed): address equals method issue (#10152)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
1 parent f500ad6 commit ddc927f

File tree

1 file changed

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

1 file changed

+19
-2
lines changed

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

+19-2
Original file line numberDiff line numberDiff line change
@@ -211,9 +211,26 @@ 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.author?.iconURL === other.author?.icon_url &&
219+
this.author?.name === other.author?.name &&
220+
this.author?.url === other.author?.url &&
221+
this.color === (other.color ?? null) &&
222+
this.description === (other.description ?? null) &&
223+
this.footer?.iconURL === other.footer?.icon_url &&
224+
this.footer?.text === other.footer?.text &&
225+
this.image?.url === other.image?.url &&
226+
this.thumbnail?.url === other.thumbnail?.url &&
227+
(this.timestamp && Date.parse(this.timestamp)) === (other.timestamp ? Date.parse(other.timestamp) : null) &&
228+
this.title === (other.title ?? null) &&
229+
this.url === (other.url ?? null) &&
230+
this.video?.url === other.video?.url &&
231+
isEqual(this.fields, other.fields?.map(field => ({ ...field, inline: field.inline ?? false })) ?? []) &&
232+
isEqual(this.provider, other.provider ?? null)
233+
);
217234
}
218235
}
219236

0 commit comments

Comments
 (0)