fix: disable auto-create topics, use /link instead
This commit is contained in:
parent
47c5c8f4b9
commit
cd5be52b2b
18
bridge.py
18
bridge.py
@ -46,9 +46,17 @@ async def on_tracker_event(event: dict):
|
|||||||
if event_type == "message.new":
|
if event_type == "message.new":
|
||||||
msg = event.get("data", {})
|
msg = event.get("data", {})
|
||||||
author = msg.get("author", {})
|
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)
|
# 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
|
return
|
||||||
|
|
||||||
project_id = msg.get("project_id")
|
project_id = msg.get("project_id")
|
||||||
@ -95,12 +103,8 @@ async def on_tracker_event(event: dict):
|
|||||||
if topic_map.get_topic(project_id):
|
if topic_map.get_topic(project_id):
|
||||||
return
|
return
|
||||||
|
|
||||||
# Auto-create topic in Telegram
|
# Auto-create disabled — use /link to bind topics manually
|
||||||
topic_id = await _create_topic(project_name)
|
logger.info("New project %s (%s) — use /link to bind a topic", project_name, project_id[:8])
|
||||||
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])
|
|
||||||
|
|
||||||
|
|
||||||
# Track online members
|
# Track online members
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user