From fb6907f9ee236c5bb29749b7df4d26d237c128c0 Mon Sep 17 00:00:00 2001 From: Rajeh Taher Date: Fri, 26 Sep 2025 09:26:59 +0300 Subject: [PATCH] socket: changes to onWhatsApp --- src/Socket/socket.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/Socket/socket.ts b/src/Socket/socket.ts index dfa9303d..7fcc08d8 100644 --- a/src/Socket/socket.ts +++ b/src/Socket/socket.ts @@ -259,12 +259,18 @@ export const makeSocket = (config: SocketConfig) => { } const onWhatsApp = async (...jids: string[]) => { - const usyncQuery = new USyncQuery().withLIDProtocol().withContactProtocol() + let usyncQuery = new USyncQuery().withLIDProtocol() + let contactEnabled = false; for (const jid of jids) { if (isLidUser(jid)) { - usyncQuery.withUser(new USyncUser().withId(jid)) // intentional + // usyncQuery.withUser(new USyncUser().withLid(jid)) // intentional but needs JID too + continue; } else { + if (!contactEnabled) { + contactEnabled = true + usyncQuery = usyncQuery.withContactProtocol() + } const phone = `+${jid.replace('+', '').split('@')[0]?.split(':')[0]}` usyncQuery.withUser(new USyncUser().withPhone(phone)) }