mirror of
https://github.com/FranP-code/Baileys.git
synced 2025-10-13 00:32:22 +00:00
messages-send: rigid checks on per-jid patch (fixes peer messages)
Peer messages were causing an error here since they are only sent to the device (no otherJids)
This commit is contained in:
@@ -286,20 +286,25 @@ export const makeMessagesSocket = (config: SocketConfig) => {
|
||||
}
|
||||
|
||||
let shouldIncludeDeviceIdentity = false
|
||||
|
||||
const nodes = await Promise.all(
|
||||
patched.map(
|
||||
async patchedMessageWithJid => {
|
||||
const { recipientJid: jid, ...patchedMessage } = patchedMessageWithJid
|
||||
if(!jid) {
|
||||
return {} as BinaryNode
|
||||
}
|
||||
|
||||
const bytes = encodeWAMessage(patchedMessage)
|
||||
const { type, ciphertext } = await signalRepository
|
||||
.encryptMessage({ jid: jid!, data: bytes })
|
||||
.encryptMessage({ jid: jid, data: bytes })
|
||||
if(type === 'pkmsg') {
|
||||
shouldIncludeDeviceIdentity = true
|
||||
}
|
||||
|
||||
const node: BinaryNode = {
|
||||
tag: 'to',
|
||||
attrs: { jid: jid! },
|
||||
attrs: { jid: jid },
|
||||
content: [{
|
||||
tag: 'enc',
|
||||
attrs: {
|
||||
|
||||
Reference in New Issue
Block a user