From cd5be52b2b131b89cffc3ad8edc811146b680532 Mon Sep 17 00:00:00 2001 From: Markov Date: Fri, 13 Mar 2026 23:32:51 +0100 Subject: [PATCH] fix: disable auto-create topics, use /link instead --- bridge.py | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/bridge.py b/bridge.py index 1f3315a..9c6707a 100644 --- a/bridge.py +++ b/bridge.py @@ -46,9 +46,17 @@ async def on_tracker_event(event: dict): if event_type == "message.new": msg = event.get("data", {}) author = msg.get("author", {}) + logger.info("message.new from %s: %s", author.get("slug", "?"), (msg.get("content", ""))[:50]) # Skip messages from bridge itself (avoid echo) - if author.get("slug") == "bridge": + author_slug = author.get("slug", "") + if author_slug == "bridge": + return + + # Skip messages that bridge sent on behalf of Telegram users + # (they contain "[Username]" prefix) + text_content = msg.get("content", "") + if text_content.startswith("[") and "] " in text_content[:50]: return project_id = msg.get("project_id") @@ -95,12 +103,8 @@ async def on_tracker_event(event: dict): if topic_map.get_topic(project_id): return - # Auto-create topic in Telegram - topic_id = await _create_topic(project_name) - if topic_id: - topic_map.set(topic_id, project_id) - await _send_to_topic(topic_id, f"πŸ”— Π’ΠΎΠΏΠΈΠΊ привязан ΠΊ ΠΏΡ€ΠΎΠ΅ΠΊΡ‚Ρƒ {_escape_html(project_name)}") - logger.info("Auto-created topic %d for project %s (%s)", topic_id, project_name, project_id[:8]) + # Auto-create disabled β€” use /link to bind topics manually + logger.info("New project %s (%s) β€” use /link to bind a topic", project_name, project_id[:8]) # Track online members