Skip to content

Commit

Permalink
fix(Embed): address equals method issue (#10152)
Browse files Browse the repository at this point in the history
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
  • Loading branch information
sdanialraza and kodiakhq[bot] authored Mar 24, 2024
1 parent f500ad6 commit ddc927f
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions packages/discord.js/src/structures/Embed.js
Original file line number Diff line number Diff line change
Expand Up @@ -211,9 +211,26 @@ class Embed {
*/
equals(other) {
if (other instanceof Embed) {
return isEqual(other.data, this.data);
return isEqual(this.data, other.data);
}
return isEqual(other, this.data);

return (
this.author?.iconURL === other.author?.icon_url &&
this.author?.name === other.author?.name &&
this.author?.url === other.author?.url &&
this.color === (other.color ?? null) &&
this.description === (other.description ?? null) &&
this.footer?.iconURL === other.footer?.icon_url &&
this.footer?.text === other.footer?.text &&
this.image?.url === other.image?.url &&
this.thumbnail?.url === other.thumbnail?.url &&
(this.timestamp && Date.parse(this.timestamp)) === (other.timestamp ? Date.parse(other.timestamp) : null) &&
this.title === (other.title ?? null) &&
this.url === (other.url ?? null) &&
this.video?.url === other.video?.url &&
isEqual(this.fields, other.fields?.map(field => ({ ...field, inline: field.inline ?? false })) ?? []) &&
isEqual(this.provider, other.provider ?? null)
);
}
}

Expand Down

0 comments on commit ddc927f

Please sign in to comment.