mirror of
https://github.com/FranP-code/Baileys.git
synced 2025-10-13 00:32:22 +00:00
fix: possible ack fix
This commit is contained in:
@@ -23,20 +23,20 @@ export const makeMessagesRecvSocket = (config: SocketConfig) => {
|
|||||||
|
|
||||||
const sendMessageAck = async({ attrs }: BinaryNode, includeType: boolean) => {
|
const sendMessageAck = async({ attrs }: BinaryNode, includeType: boolean) => {
|
||||||
const isGroup = !!attrs.participant
|
const isGroup = !!attrs.participant
|
||||||
const { user: meUser } = jidDecode(authState.creds.me!.id!)
|
const meJid = authState.creds.me!.id!
|
||||||
const stanza: BinaryNode = {
|
const stanza: BinaryNode = {
|
||||||
tag: 'ack',
|
tag: 'ack',
|
||||||
attrs: {
|
attrs: {
|
||||||
class: 'receipt',
|
class: 'receipt',
|
||||||
id: attrs.id,
|
id: attrs.id,
|
||||||
to: isGroup ? attrs.from : authState.creds.me!.id,
|
to: attrs.from,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(includeType) {
|
if(includeType) {
|
||||||
stanza.attrs.type = attrs.type
|
stanza.attrs.type = attrs.type
|
||||||
}
|
}
|
||||||
if(isGroup) {
|
if(isGroup) {
|
||||||
stanza.attrs.participant = jidEncode(meUser, 's.whatsapp.net')
|
stanza.attrs.participant = jidNormalizedUser(meJid)
|
||||||
}
|
}
|
||||||
logger.debug({ attrs: stanza.attrs }, 'sent message ack')
|
logger.debug({ attrs: stanza.attrs }, 'sent message ack')
|
||||||
await sendNode(stanza)
|
await sendNode(stanza)
|
||||||
@@ -513,5 +513,5 @@ export const makeMessagesRecvSocket = (config: SocketConfig) => {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
return { ...sock, processMessage }
|
return { ...sock, processMessage, sendMessageAck }
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user