Skip to content

Commit a468ae8

Browse files
fix(Message): properly compare attachments and embeds (discordjs#10282)
* fix(Message): properly compare `attachments` and `embeds` * refactor: use `has` instead of `get` * refactor: keep length checks --------- Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
1 parent 638b896 commit a468ae8

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

packages/discord.js/src/structures/Message.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -973,10 +973,12 @@ class Message extends Base {
973973
this.id === message.id &&
974974
this.author.id === message.author.id &&
975975
this.content === message.content &&
976-
this.tts === message.tts &&
977976
this.nonce === message.nonce &&
977+
this.tts === message.tts &&
978+
this.attachments.size === message.attachments.size &&
978979
this.embeds.length === message.embeds.length &&
979-
this.attachments.length === message.attachments.length;
980+
this.attachments.every(attachment => message.attachments.has(attachment.id)) &&
981+
this.embeds.every((embed, index) => embed.equals(message.embeds[index]));
980982

981983
if (equal && rawData) {
982984
equal =

0 commit comments

Comments
 (0)