messages-recv: DISABLE MESSAGE RESEND

This commit is contained in:
Rajeh Taher
2025-01-31 20:46:13 +02:00
parent 3fca643d92
commit 9f61f3acf0

View File

@@ -943,18 +943,20 @@ export const makeMessagesRecvSocket = (config: SocketConfig) => {
const handleBadAck = async({ attrs }: BinaryNode) => { const handleBadAck = async({ attrs }: BinaryNode) => {
const key: WAMessageKey = { remoteJid: attrs.from, fromMe: true, id: attrs.id } const key: WAMessageKey = { remoteJid: attrs.from, fromMe: true, id: attrs.id }
// current hypothesis is that if pash is sent in the ack
// it means -- the message hasn't reached all devices yet // WARNING: REFRAIN FROM ENABLING THIS FOR NOW. IT WILL CAUSE A LOOP
// we'll retry sending the message here // // current hypothesis is that if pash is sent in the ack
if(attrs.phash) { // // it means -- the message hasn't reached all devices yet
logger.info({ attrs }, 'received phash in ack, resending message...') // // we'll retry sending the message here
const msg = await getMessage(key) // if(attrs.phash) {
if(msg) { // logger.info({ attrs }, 'received phash in ack, resending message...')
await relayMessage(key.remoteJid!, msg, { messageId: key.id!, useUserDevicesCache: false }) // const msg = await getMessage(key)
} else { // if(msg) {
logger.warn({ attrs }, 'could not send message again, as it was not found') // await relayMessage(key.remoteJid!, msg, { messageId: key.id!, useUserDevicesCache: false })
} // } else {
} // logger.warn({ attrs }, 'could not send message again, as it was not found')
// }
// }
// error in acknowledgement, // error in acknowledgement,
// device could not display the message // device could not display the message