From 9cb1bfa1c12e7fc4e9049210200b1ed22560a470 Mon Sep 17 00:00:00 2001 From: Peter Siska <63866+peschee@users.noreply.github.com> Date: Sat, 10 Jan 2026 22:40:19 +0000 Subject: [PATCH] fix(whatsapp): pass authDir to jidToE164 for LID mention detection WhatsApp group mentions using the new Linked ID format (@lid) were not being detected because jidToE164() was called without the authDir needed to find the LID reverse mapping files. Now isBotMentioned() and debugMention() accept an optional authDir parameter, which is passed through from account.authDir. --- src/web/auto-reply.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/web/auto-reply.ts b/src/web/auto-reply.ts index ee9786680..8306b8186 100644 --- a/src/web/auto-reply.ts +++ b/src/web/auto-reply.ts @@ -189,6 +189,7 @@ function buildMentionConfig( function isBotMentioned( msg: WebInboundMsg, mentionCfg: MentionConfig, + authDir?: string, ): boolean { const clean = (text: string) => // Remove zero-width and directionality markers WhatsApp injects around display names @@ -198,7 +199,7 @@ function isBotMentioned( if (msg.mentionedJids?.length && !isSelfChat) { const normalizedMentions = msg.mentionedJids - .map((jid) => jidToE164(jid) ?? jid) + .map((jid) => jidToE164(jid, authDir ? { authDir } : undefined) ?? jid) .filter(Boolean); if (msg.selfE164 && normalizedMentions.includes(msg.selfE164)) return true; if (msg.selfJid && msg.selfE164) { @@ -230,8 +231,9 @@ function isBotMentioned( function debugMention( msg: WebInboundMsg, mentionCfg: MentionConfig, + authDir?: string, ): { wasMentioned: boolean; details: Record } { - const result = isBotMentioned(msg, mentionCfg); + const result = isBotMentioned(msg, mentionCfg, authDir); const details = { from: msg.from, body: msg.body, @@ -1584,7 +1586,7 @@ export async function monitorWebProvider( groupHistories.set(groupHistoryKey, history); } - const mentionDebug = debugMention(msg, mentionConfig); + const mentionDebug = debugMention(msg, mentionConfig, account.authDir); replyLogger.debug( { conversationId,