socket: fix onWhatsApp

This commit is contained in:
Rajeh Taher
2025-09-09 00:54:59 +03:00
parent 4a1a06bed5
commit 8204e57a40
2 changed files with 3 additions and 4 deletions
+2 -1
View File
@@ -90,7 +90,7 @@ export class LIDMappingStore {
if (!lidUser) {
logger.trace(`No LID mapping found for PN user ${pnUser}; getting from USync`)
const { exists, lid } = (await this.onWhatsAppFunc?.(pn))?.[0]!
const { exists, lid } = (await this.onWhatsAppFunc?.(pn))?.[0]! // this function already adds LIDs to mapping
if (exists) {
lidUser = jidDecode(lid)?.user
} else {
@@ -119,6 +119,7 @@ export class LIDMappingStore {
// Look up reverse user mapping
const lidUser = decoded.user
// TODO: remove this style and instead load all mappings somehow, and then assign them in the map
const stored = await this.keys.get('lid-mapping', [`${lidUser}_reverse`])
const pnUser = stored[`${lidUser}_reverse`]
+1 -3
View File
@@ -257,10 +257,8 @@ export const makeSocket = (config: SocketConfig) => {
}
const onWhatsApp = async (...jids: string[]) => {
const usyncQuery = new USyncQuery().withLIDProtocol()
const usyncQuery = new USyncQuery().withLIDProtocol().withContactProtocol()
// .withContactProtocol() when dealing with phone
// .withId simply with LIDs and WIDs
for (const jid of jids) {
if (isLidUser(jid)) {
usyncQuery.withUser(new USyncUser().withId(jid)) // intentional