From 41851d9e34e43029134a89ceabce528422d1faff Mon Sep 17 00:00:00 2001 From: Adhiraj Singh Date: Wed, 18 Jan 2023 16:23:31 +0530 Subject: [PATCH] fix: getChatId --- src/Utils/process-message.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/Utils/process-message.ts b/src/Utils/process-message.ts index 3a2f48c..87a88ee 100644 --- a/src/Utils/process-message.ts +++ b/src/Utils/process-message.ts @@ -76,8 +76,12 @@ export const shouldIncrementChatUnread = (message: proto.IWebMessageInfo) => ( * Get the ID of the chat from the given key. * Typically -- that'll be the remoteJid, but for broadcasts, it'll be the participant */ -export const getChatId = ({ remoteJid, participant }: proto.IMessageKey) => { - if(isJidBroadcast(remoteJid!) && !isJidStatusBroadcast(remoteJid!)) { +export const getChatId = ({ remoteJid, participant, fromMe }: proto.IMessageKey) => { + if( + isJidBroadcast(remoteJid!) + && !isJidStatusBroadcast(remoteJid!) + && !fromMe + ) { return participant! }