fallback missing Telegram city topics

This commit is contained in:
2569718930@qq.com
2026-06-11 15:58:13 +08:00
parent c5e5e73ce1
commit 87bf7c3575
2 changed files with 62 additions and 0 deletions
+20
View File
@@ -1733,6 +1733,7 @@ def _process_airport_city(
# Send to all target chats
sent = False
for chat_id in chat_ids:
thread_id = 0
try:
kwargs = {}
thread_id = _resolve_thread_id(chat_id, city)
@@ -1741,6 +1742,25 @@ def _process_airport_city(
_rate_limited_send(bot, chat_id, message, **kwargs)
sent = True
except Exception as exc:
if thread_id and "message thread not found" in str(exc).lower():
logger.warning(
"airport push thread missing; retrying main chat city={} chat_id={} thread_id={}",
city,
chat_id,
thread_id,
)
try:
_rate_limited_send(bot, chat_id, message)
sent = True
continue
except Exception as fallback_exc:
logger.warning(
"airport push main chat fallback failed city={} chat_id={}: {}",
city,
chat_id,
fallback_exc,
)
continue
logger.warning("airport push failed city={} chat_id={}: {}", city, chat_id, exc)
if sent: