From 2c439803d7e2157bb342d56b9f4cc1e482337a77 Mon Sep 17 00:00:00 2001 From: Hyungi Ahn Date: Thu, 19 Mar 2026 15:19:56 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20=ED=9A=8C=EA=B3=A0=20=EC=B1=84=EB=84=90?= =?UTF-8?q?=20=EB=B4=87=20=EB=A9=94=EC=8B=9C=EC=A7=80=20=ED=95=84=ED=84=B0?= =?UTF-8?q?=EB=A7=81=EC=9C=BC=EB=A1=9C=20=EB=AC=B4=ED=95=9C=20=EB=A3=A8?= =?UTF-8?q?=ED=94=84=20=EB=B0=A9=EC=A7=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 확인 메시지가 다시 폴링되어 재전송되는 루프 발생. RETROSPECT_USER_IDS로 허용된 사용자만 포워딩. Co-Authored-By: Claude Opus 4.6 (1M context) --- chat_bridge.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/chat_bridge.py b/chat_bridge.py index 87e4fb9..de91453 100644 --- a/chat_bridge.py +++ b/chat_bridge.py @@ -29,6 +29,8 @@ RETROSPECT_CHANNEL_ID = int(os.getenv("RETROSPECT_CHANNEL_ID", "0")) RETROSPECT_CHAT_WEBHOOK_URL = os.getenv("RETROSPECT_CHAT_WEBHOOK_URL", "") N8N_RETROSPECT_WEBHOOK_URL = os.getenv("N8N_RETROSPECT_WEBHOOK_URL", "http://localhost:5678/webhook/retrospect") +# 회고 채널에서 포워딩할 사용자 ID (봇 메시지 제외) +RETROSPECT_USER_IDS = {int(x) for x in os.getenv("RETROSPECT_USER_IDS", "6").split(",") if x.strip()} # State sid: str = "" @@ -175,8 +177,10 @@ async def poll_retrospect_channel(client: httpx.AsyncClient): post_id = post.get("post_id", 0) if post_id <= retro_last_seen_post_id: continue - # 텍스트 메시지만 포워딩 (파일/시스템 메시지 제외) - if post.get("type", "normal") == "normal" and post.get("message", "").strip(): + # 텍스트 메시지만 포워딩 (파일/시스템/봇 메시지 제외) + if (post.get("type", "normal") == "normal" + and post.get("message", "").strip() + and post.get("creator_id", 0) in RETROSPECT_USER_IDS): await forward_to_n8n(post) if posts: max_id = max(p.get("post_id", 0) for p in posts)