fix(cron): support Telegram topic delivery via platform:chat_id:thread_id format (#2455)
Parse thread_id from explicit deliver target (e.g. telegram:-1003724596514:17) and forward it to _send_to_platform and mirror_to_session. Previously _resolve_delivery_target() always set thread_id=None when parsing the platform:chat_id format, breaking cron job delivery to specific Telegram topics. Added tests: - test_explicit_telegram_topic_target_with_thread_id - test_explicit_telegram_chat_id_without_thread_id Also updated CRONJOB_SCHEMA deliver description to document the platform:chat_id:thread_id format. Co-authored-by: Alex Ferrari <alex@thealexferrari.com>
This commit is contained in:
@@ -80,11 +80,16 @@ def _resolve_delivery_target(job: dict) -> Optional[dict]:
|
||||
}
|
||||
|
||||
if ":" in deliver:
|
||||
platform_name, chat_id = deliver.split(":", 1)
|
||||
platform_name, rest = deliver.split(":", 1)
|
||||
# Check for thread_id suffix (e.g. "telegram:-1003724596514:17")
|
||||
if ":" in rest:
|
||||
chat_id, thread_id = rest.split(":", 1)
|
||||
else:
|
||||
chat_id, thread_id = rest, None
|
||||
return {
|
||||
"platform": platform_name,
|
||||
"chat_id": chat_id,
|
||||
"thread_id": None,
|
||||
"thread_id": thread_id,
|
||||
}
|
||||
|
||||
platform_name = deliver
|
||||
|
||||
Reference in New Issue
Block a user