From a468ae8bb5a9de9cb34d40493c59693e84c2812a Mon Sep 17 00:00:00 2001 From: Danial Raza Date: Fri, 24 May 2024 16:19:28 +0200 Subject: [PATCH] fix(Message): properly compare `attachments` and `embeds` (#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> --- packages/discord.js/src/structures/Message.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/discord.js/src/structures/Message.js b/packages/discord.js/src/structures/Message.js index 79d6d78d7439..bbd550cc21f7 100644 --- a/packages/discord.js/src/structures/Message.js +++ b/packages/discord.js/src/structures/Message.js @@ -973,10 +973,12 @@ class Message extends Base { this.id === message.id && this.author.id === message.author.id && this.content === message.content && - this.tts === message.tts && this.nonce === message.nonce && + this.tts === message.tts && + this.attachments.size === message.attachments.size && this.embeds.length === message.embeds.length && - this.attachments.length === message.attachments.length; + this.attachments.every(attachment => message.attachments.has(attachment.id)) && + this.embeds.every((embed, index) => embed.equals(message.embeds[index])); if (equal && rawData) { equal =