mirror of
https://github.com/FranP-code/Baileys.git
synced 2025-10-13 00:32:22 +00:00
fix receipt from other device not working
This commit is contained in:
@@ -360,8 +360,13 @@ export const makeMessagesRecvSocket = (config: SocketConfig) => {
|
|||||||
logger.debug({ attrs: node.attrs }, 'sending receipt for ack')
|
logger.debug({ attrs: node.attrs }, 'sending receipt for ack')
|
||||||
})
|
})
|
||||||
|
|
||||||
const handleReceipt = ({ attrs, content }: BinaryNode) => {
|
const handleReceipt = ({ tag, attrs, content }: BinaryNode) => {
|
||||||
const sender = attrs.participant || attrs.from
|
if(tag === 'receipt') {
|
||||||
|
// if not read or no type (no type = delivered, but message sent from other device)
|
||||||
|
if(attrs.type !== 'read' && !!attrs.type) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
const status = attrs.type === 'read' ? proto.WebMessageInfo.WebMessageInfoStatus.READ : proto.WebMessageInfo.WebMessageInfoStatus.DELIVERY_ACK
|
const status = attrs.type === 'read' ? proto.WebMessageInfo.WebMessageInfoStatus.READ : proto.WebMessageInfo.WebMessageInfoStatus.DELIVERY_ACK
|
||||||
const ids = [attrs.id]
|
const ids = [attrs.id]
|
||||||
if(Array.isArray(content)) {
|
if(Array.isArray(content)) {
|
||||||
@@ -380,7 +385,7 @@ export const makeMessagesRecvSocket = (config: SocketConfig) => {
|
|||||||
})))
|
})))
|
||||||
}
|
}
|
||||||
|
|
||||||
ws.on('CB:receipt,type:read', handleReceipt)
|
ws.on('CB:receipt', handleReceipt)
|
||||||
ws.on('CB:ack,class:message', handleReceipt)
|
ws.on('CB:ack,class:message', handleReceipt)
|
||||||
|
|
||||||
ws.on('CB:notification', async(node: BinaryNode) => {
|
ws.on('CB:notification', async(node: BinaryNode) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user