mirror of
https://github.com/FranP-code/Baileys.git
synced 2025-10-13 00:32:22 +00:00
fix: possibly more accurate receipts
This commit is contained in:
@@ -29,7 +29,7 @@ export const makeMessagesRecvSocket = (config: SocketConfig) => {
|
|||||||
attrs: {
|
attrs: {
|
||||||
class: 'receipt',
|
class: 'receipt',
|
||||||
id: attrs.id,
|
id: attrs.id,
|
||||||
to: isGroup ? attrs.from : jidEncode(jidDecode(authState.creds.me!.id).user, 'c.us'),
|
to: isGroup ? attrs.from : authState.creds.me!.id,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(isGroup) {
|
if(isGroup) {
|
||||||
@@ -347,7 +347,6 @@ export const makeMessagesRecvSocket = (config: SocketConfig) => {
|
|||||||
} else {
|
} else {
|
||||||
const isStatus = isJidStatusBroadcast(stanza.attrs.from)
|
const isStatus = isJidStatusBroadcast(stanza.attrs.from)
|
||||||
recpAttrs = {
|
recpAttrs = {
|
||||||
type: 'inactive',
|
|
||||||
id: stanza.attrs.id,
|
id: stanza.attrs.id,
|
||||||
}
|
}
|
||||||
if(isGroup || isStatus) {
|
if(isGroup || isStatus) {
|
||||||
@@ -419,7 +418,8 @@ 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 = async(node: BinaryNode) => {
|
||||||
|
const { attrs, content } = node
|
||||||
const isRead = isReadReceipt(attrs.type)
|
const isRead = isReadReceipt(attrs.type)
|
||||||
const status = isRead ? proto.WebMessageInfo.WebMessageInfoStatus.READ : proto.WebMessageInfo.WebMessageInfoStatus.DELIVERY_ACK
|
const status = isRead ? proto.WebMessageInfo.WebMessageInfoStatus.READ : proto.WebMessageInfo.WebMessageInfoStatus.DELIVERY_ACK
|
||||||
const ids = [attrs.id]
|
const ids = [attrs.id]
|
||||||
@@ -439,6 +439,8 @@ export const makeMessagesRecvSocket = (config: SocketConfig) => {
|
|||||||
},
|
},
|
||||||
update: { status }
|
update: { status }
|
||||||
})))
|
})))
|
||||||
|
|
||||||
|
await sendMessageAck(node)
|
||||||
}
|
}
|
||||||
|
|
||||||
ws.on('CB:receipt', handleReceipt)
|
ws.on('CB:receipt', handleReceipt)
|
||||||
|
|||||||
Reference in New Issue
Block a user