fix: getChatId

This commit is contained in:
Adhiraj Singh
2023-01-18 16:23:31 +05:30
parent 9591a02382
commit 41851d9e34

View File

@@ -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!
}