From 02f9df5de4ca7948ad505bff935598f2b03ddf58 Mon Sep 17 00:00:00 2001 From: Adhiraj Singh Date: Mon, 7 Nov 2022 14:40:08 +0530 Subject: [PATCH] fix: check for content in "isRealMessage" --- src/Utils/process-message.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Utils/process-message.ts b/src/Utils/process-message.ts index e2b5c6d..02c94a2 100644 --- a/src/Utils/process-message.ts +++ b/src/Utils/process-message.ts @@ -2,7 +2,7 @@ import { AxiosRequestConfig } from 'axios' import type { Logger } from 'pino' import { proto } from '../../WAProto' import { AuthenticationCreds, BaileysEventEmitter, Chat, GroupMetadata, ParticipantAction, SignalKeyStoreWithTransaction, WAMessageStubType } from '../Types' -import { downloadAndProcessHistorySyncNotification, normalizeMessageContent, toNumber } from '../Utils' +import { downloadAndProcessHistorySyncNotification, getContentType, normalizeMessageContent, toNumber } from '../Utils' import { areJidsSameUser, jidNormalizedUser } from '../WABinary' type ProcessMessageContext = { @@ -54,6 +54,7 @@ export const cleanMessage = (message: proto.IWebMessageInfo, meId: string) => { export const isRealMessage = (message: proto.IWebMessageInfo, meId: string) => { const normalizedContent = normalizeMessageContent(message.message) + const hasSomeContent = !!getContentType(normalizedContent) return ( !!normalizedContent || REAL_MSG_STUB_TYPES.has(message.messageStubType!) @@ -62,6 +63,7 @@ export const isRealMessage = (message: proto.IWebMessageInfo, meId: string) => { && message.messageStubParameters?.some(p => areJidsSameUser(meId, p)) ) ) + && hasSomeContent && !normalizedContent?.protocolMessage && !normalizedContent?.reactionMessage }