fix(whatsapp): handle LID group mentions (#2663)
Co-authored-by: Xubin Ren <52506698+Re-bin@users.noreply.github.com>
This commit is contained in:
@@ -216,7 +216,7 @@ class WhatsAppChannel(BaseChannel):
|
||||
|
||||
# Extract just the phone number or lid as chat_id
|
||||
is_group = data.get("isGroup", False)
|
||||
was_mentioned = data.get("wasMentioned", False)
|
||||
was_mentioned = bool(data.get("wasMentioned", False) or data.get("isReplyToBot", False))
|
||||
|
||||
if is_group and getattr(self.config, "group_policy", "open") == "mention":
|
||||
if not was_mentioned:
|
||||
@@ -225,7 +225,8 @@ class WhatsAppChannel(BaseChannel):
|
||||
# Classify by JID suffix: @s.whatsapp.net = phone, @lid.whatsapp.net = LID
|
||||
# The bridge's pn/sender fields don't consistently map to phone/LID across versions.
|
||||
raw_a = pn or ""
|
||||
raw_b = sender or ""
|
||||
participant = data.get("participant", "")
|
||||
raw_b = participant or sender or ""
|
||||
id_a = raw_a.split("@")[0] if "@" in raw_a else raw_a
|
||||
id_b = raw_b.split("@")[0] if "@" in raw_b else raw_b
|
||||
|
||||
@@ -289,6 +290,8 @@ class WhatsAppChannel(BaseChannel):
|
||||
"message_id": message_id,
|
||||
"timestamp": data.get("timestamp"),
|
||||
"is_group": data.get("isGroup", False),
|
||||
"participant": participant or None,
|
||||
"is_reply_to_bot": data.get("isReplyToBot", False),
|
||||
},
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user