mirror of
https://github.com/FranP-code/Baileys.git
synced 2025-10-13 00:32:22 +00:00
fix: cleanMessage for reaction messages
This commit is contained in:
@@ -22,16 +22,17 @@ const MSG_MISSED_CALL_TYPES = new Set([
|
||||
])
|
||||
|
||||
/** Cleans a received message to further processing */
|
||||
export const cleanMessage = (message: proto.IWebMessageInfo) => {
|
||||
export const cleanMessage = (message: proto.IWebMessageInfo, meId: string) => {
|
||||
// ensure remoteJid doesn't have device or agent in it
|
||||
message.key.remoteJid = jidNormalizedUser(message.key.remoteJid!)
|
||||
const content = normalizeMessageContent(message.message)
|
||||
if(content) {
|
||||
// if the message has a reaction, ensure fromMe & remoteJid are from our perspective
|
||||
const msgKey = content.reactionMessage!.key!
|
||||
// if the message has a reaction, ensure fromMe & remoteJid are from our perspective
|
||||
if(content?.reactionMessage) {
|
||||
const msgKey = content.reactionMessage.key!
|
||||
if(!message.key.fromMe) {
|
||||
msgKey.fromMe = areJidsSameUser(msgKey.participant || msgKey.remoteJid, meId)
|
||||
msgKey.remoteJid = message.key.remoteJid
|
||||
msgKey.fromMe = !msgKey.fromMe
|
||||
msgKey.participant = msgKey.participant || message.key.participant
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user