mirror of
https://github.com/FranP-code/Baileys.git
synced 2025-10-13 00:32:22 +00:00
fix: check for content in "isRealMessage"
This commit is contained in:
@@ -2,7 +2,7 @@ import { AxiosRequestConfig } from 'axios'
|
|||||||
import type { Logger } from 'pino'
|
import type { Logger } from 'pino'
|
||||||
import { proto } from '../../WAProto'
|
import { proto } from '../../WAProto'
|
||||||
import { AuthenticationCreds, BaileysEventEmitter, Chat, GroupMetadata, ParticipantAction, SignalKeyStoreWithTransaction, WAMessageStubType } from '../Types'
|
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'
|
import { areJidsSameUser, jidNormalizedUser } from '../WABinary'
|
||||||
|
|
||||||
type ProcessMessageContext = {
|
type ProcessMessageContext = {
|
||||||
@@ -54,6 +54,7 @@ export const cleanMessage = (message: proto.IWebMessageInfo, meId: string) => {
|
|||||||
|
|
||||||
export const isRealMessage = (message: proto.IWebMessageInfo, meId: string) => {
|
export const isRealMessage = (message: proto.IWebMessageInfo, meId: string) => {
|
||||||
const normalizedContent = normalizeMessageContent(message.message)
|
const normalizedContent = normalizeMessageContent(message.message)
|
||||||
|
const hasSomeContent = !!getContentType(normalizedContent)
|
||||||
return (
|
return (
|
||||||
!!normalizedContent
|
!!normalizedContent
|
||||||
|| REAL_MSG_STUB_TYPES.has(message.messageStubType!)
|
|| 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))
|
&& message.messageStubParameters?.some(p => areJidsSameUser(meId, p))
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
&& hasSomeContent
|
||||||
&& !normalizedContent?.protocolMessage
|
&& !normalizedContent?.protocolMessage
|
||||||
&& !normalizedContent?.reactionMessage
|
&& !normalizedContent?.reactionMessage
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user