feat(alerts): prefijo 'OPENSHORTS ✂️ -' en todos los mensajes de Telegram

El chat de Telegram es compartido con Upload-Post y otros productos, así que
cada mensaje de OpenShorts se marca con el nombre para distinguirlos de un
vistazo. Aplicado en send_telegram, cubre todas las alertas (pagos, subs,
churn, clips).
This commit is contained in:
juancarlos.cavero 2026-07-21 02:20:56 +02:00
parent 2efbeb2828
commit 7d6c232165

View file

@ -48,6 +48,11 @@ def _cooldown_ok(kind: str) -> bool:
return True return True
# Prefix on every OpenShorts Telegram message. The chat is shared with other
# products (Upload-Post, …), so this tags which one each alert is from.
TELEGRAM_PREFIX = "OPENSHORTS ✂️ - "
async def send_telegram(text: str): async def send_telegram(text: str):
"""Push a plain-text message to the admin's Telegram chat. No-op if unset. """Push a plain-text message to the admin's Telegram chat. No-op if unset.
@ -58,7 +63,8 @@ async def send_telegram(text: str):
try: try:
import httpx import httpx
url = f"https://api.telegram.org/bot{settings.telegram_bot_token}/sendMessage" url = f"https://api.telegram.org/bot{settings.telegram_bot_token}/sendMessage"
payload = {"chat_id": settings.telegram_chat_id, "text": text, payload = {"chat_id": settings.telegram_chat_id,
"text": TELEGRAM_PREFIX + text,
"disable_web_page_preview": True} "disable_web_page_preview": True}
async with httpx.AsyncClient(timeout=10) as client: async with httpx.AsyncClient(timeout=10) as client:
await client.post(url, json=payload) await client.post(url, json=payload)