add support for group topics tg notifications
Build and Push Docker Images / Build and Push Docker Images (push) Failing after 8s

This commit is contained in:
2026-08-02 06:40:11 +05:00
parent 2db0369d7c
commit 6cdf042f49
3 changed files with 13 additions and 0 deletions
+6
View File
@@ -12,6 +12,8 @@ telegram_loop = None
BOT_TOKEN = config("TG_BOT_TOKEN", default="killme", cast=str)
CHAT_ID = config("TG_CHAT_ID", default="drake", cast=str)
# Optional forum topic to post into. If empty, messages go to the group's General topic.
TOPIC_ID = config("TG_TOPIC_ID", default="", cast=str)
if not BOT_TOKEN or not isinstance(BOT_TOKEN, str):
raise ValueError(
@@ -57,10 +59,14 @@ else:
async def send_telegram_alert(markdown_message: str):
logger.info("[TELEGRAM] Preparing to send alert...")
kwargs = {}
if TOPIC_ID:
kwargs["message_thread_id"] = int(TOPIC_ID)
await bot.send_message(
chat_id=str(CHAT_ID),
text=markdown_message,
parse_mode=ParseMode.MARKDOWN_V2,
**kwargs,
)