fix: disable auto-create topics, use /link instead

This commit is contained in:
Markov 2026-03-13 23:32:51 +01:00
parent 47c5c8f4b9
commit cd5be52b2b

View File

@ -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"🔗 Топик привязан к проекту <b>{_escape_html(project_name)}</b>")
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