socket: changes to onWhatsApp
This commit is contained in:
@@ -259,12 +259,18 @@ export const makeSocket = (config: SocketConfig) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const onWhatsApp = async (...jids: string[]) => {
|
const onWhatsApp = async (...jids: string[]) => {
|
||||||
const usyncQuery = new USyncQuery().withLIDProtocol().withContactProtocol()
|
let usyncQuery = new USyncQuery().withLIDProtocol()
|
||||||
|
|
||||||
|
let contactEnabled = false;
|
||||||
for (const jid of jids) {
|
for (const jid of jids) {
|
||||||
if (isLidUser(jid)) {
|
if (isLidUser(jid)) {
|
||||||
usyncQuery.withUser(new USyncUser().withId(jid)) // intentional
|
// usyncQuery.withUser(new USyncUser().withLid(jid)) // intentional but needs JID too
|
||||||
|
continue;
|
||||||
} else {
|
} else {
|
||||||
|
if (!contactEnabled) {
|
||||||
|
contactEnabled = true
|
||||||
|
usyncQuery = usyncQuery.withContactProtocol()
|
||||||
|
}
|
||||||
const phone = `+${jid.replace('+', '').split('@')[0]?.split(':')[0]}`
|
const phone = `+${jid.replace('+', '').split('@')[0]?.split(':')[0]}`
|
||||||
usyncQuery.withUser(new USyncUser().withPhone(phone))
|
usyncQuery.withUser(new USyncUser().withPhone(phone))
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user