fix(web): detect self number mentions in group chats

This commit is contained in:
Peter Steinberger
2025-12-03 12:43:20 +00:00
parent 6afe6f4ecb
commit 7ea43b0145

View File

@@ -109,7 +109,21 @@ function isBotMentioned(
if (normalizedMentions.includes(bareSelf)) return true;
}
}
return mentionCfg.mentionRegexes.some((re) => re.test(msg.body));
if (mentionCfg.mentionRegexes.some((re) => re.test(msg.body))) return true;
// Fallback: detect body containing our own number (with or without +, spacing)
if (msg.selfE164) {
const selfDigits = msg.selfE164.replace(/\D/g, "");
if (selfDigits) {
const bodyDigits = msg.body.replace(/[^\d]/g, "");
if (bodyDigits.includes(selfDigits)) return true;
const bodyNoSpace = msg.body.replace(/[\s-]/g, "");
const pattern = new RegExp(`\\+?${selfDigits}`, "i");
if (pattern.test(bodyNoSpace)) return true;
}
}
return false;
}
export function resolveReplyHeartbeatMinutes(