fix: use sender from_id as actor_id in groups, not group chat_id

This commit is contained in:
daniel
2026-05-12 14:17:02 -05:00
parent 9d3a93a998
commit 138f9224c3

View File

@@ -142,7 +142,10 @@ def handler(event, context):
channel = first.get('channel', 'telegram') channel = first.get('channel', 'telegram')
chat_id = first.get('chat_id', '') chat_id = first.get('chat_id', '')
message_thread_id = first.get('message_thread_id') # int or None message_thread_id = first.get('message_thread_id') # int or None
actor_id = f"{channel}:{chat_id}" # Use sender's user ID for identity (not chat_id, which is the group ID in group chats)
from_info_early = first.get('messages', [{}])[0]
sender_id = from_info_early.get('from_id') or chat_id
actor_id = f"{channel}:{sender_id}"
# ── User registry ───────────────────────────────────────────────────── # ── User registry ─────────────────────────────────────────────────────
from_info = first.get('messages', [{}])[0] from_info = first.get('messages', [{}])[0]