From d5dc75887493f25877028d43b81101e050a3695b Mon Sep 17 00:00:00 2001 From: Nurutomo Date: Wed, 2 Apr 2025 17:26:04 +0700 Subject: [PATCH] fix #1331 (#1334) * fix for groups * lint: fix linting * messages-send: jids checking --- src/Socket/messages-send.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Socket/messages-send.ts b/src/Socket/messages-send.ts index 85e508f..50805be 100644 --- a/src/Socket/messages-send.ts +++ b/src/Socket/messages-send.ts @@ -282,7 +282,7 @@ export const makeMessagesSocket = (config: SocketConfig) => { ) => { let patched = await patchMessageBeforeSending(message, jids) if(!Array.isArray(patched)) { - patched = [{ recipientJid: jids[0], ...patched }] + patched = jids ? jids.map(jid => ({ recipientJid: jid, ...patched })) : [patched] } let shouldIncludeDeviceIdentity = false @@ -290,21 +290,21 @@ export const makeMessagesSocket = (config: SocketConfig) => { const nodes = await Promise.all( patched.map( async patchedMessageWithJid => { - const { recipientJid: jid, ...patchedMessage } = 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, data: bytes }) if(type === 'pkmsg') { shouldIncludeDeviceIdentity = true } const node: BinaryNode = { tag: 'to', - attrs: { jid: jid }, + attrs: { jid }, content: [{ tag: 'enc', attrs: {