From 1210a84e55089a543e7cc9fdb5847d23dc232fa4 Mon Sep 17 00:00:00 2001 From: toast-ts <96593068+toast-ts@users.noreply.github.com> Date: Sat, 27 Jan 2024 04:33:59 +1100 Subject: [PATCH] Fix MESSAGE_UPDATE raw event for message content being same --- src/index.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/index.ts b/src/index.ts index 55c5142..b4876b8 100644 --- a/src/index.ts +++ b/src/index.ts @@ -87,8 +87,11 @@ client.on('raw', async (packet:RawGatewayPacket)=>{ if (typeof packet.d.content === 'undefined') return; const channel = client.channels.cache.get(packet.d.channel_id) as Discord.TextBasedChannel; + const old_message = await channel.messages.fetch(packet.d.id); const new_message = await channel.messages.fetch(packet.d.id); - client.emit('messageUpdate', new_message, new_message); + if (old_message.content === new_message.content) return; + + client.emit('messageUpdate', old_message, new_message); }); client.on('raw', async (packet:RawGatewayPacket)=>{