mirror of
https://github.com/FranP-code/Baileys.git
synced 2025-10-13 00:32:22 +00:00
fix: ack before sending retry receipt
This commit is contained in:
@@ -345,8 +345,6 @@ export const makeMessagesRecvSocket = (config: SocketConfig) => {
|
||||
}
|
||||
|
||||
const handleReceipt = async(node: BinaryNode) => {
|
||||
let shouldAck = true
|
||||
|
||||
const { attrs, content } = node
|
||||
const isNodeFromMe = areJidsSameUser(attrs.participant || attrs.from, authState.creds.me?.id)
|
||||
const remoteJid = !isNodeFromMe || isJidGroup(attrs.from) ? attrs.from : attrs.recipient
|
||||
@@ -399,9 +397,10 @@ export const makeMessagesRecvSocket = (config: SocketConfig) => {
|
||||
}))
|
||||
)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
await sendMessageAck(node)
|
||||
|
||||
if(attrs.type === 'retry') {
|
||||
// correctly set who is asking for the retry
|
||||
key.participant = key.participant || attrs.from
|
||||
@@ -412,7 +411,6 @@ export const makeMessagesRecvSocket = (config: SocketConfig) => {
|
||||
await sendMessagesAgain(key, ids)
|
||||
} catch(error) {
|
||||
logger.error({ key, ids, trace: error.stack }, 'error in sending message again')
|
||||
shouldAck = false
|
||||
}
|
||||
} else {
|
||||
logger.info({ attrs, key }, 'recv retry for not fromMe message')
|
||||
@@ -421,10 +419,6 @@ export const makeMessagesRecvSocket = (config: SocketConfig) => {
|
||||
logger.info({ attrs, key }, 'will not send message again, as sent too many times')
|
||||
}
|
||||
}
|
||||
|
||||
if(shouldAck) {
|
||||
await sendMessageAck(node)
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user