try to use OK alerts to reflect successful checks

This commit is contained in:
Alex Tau 2025-08-15 18:02:43 +03:00
parent d59d5ac4e2
commit 5f9952314d
8 changed files with 22 additions and 17 deletions

View file

@ -38,7 +38,7 @@ def format_message(alert: Alert, note: str) -> str:
async def send_alert(alert: Alert, note: str = "") -> None:
try:
client = cvars.tg_client.get()
tg_client = cvars.tg_client.get()
except LookupError: # being called standalone
# cvars.config.set(get_config())
# temp_client = True
@ -47,10 +47,10 @@ async def send_alert(alert: Alert, note: str = "") -> None:
raise NotImplementedError # TODO
else:
... # temp_client = False
if client is not None:
if tg_client is not None:
room_id = cvars.config.get().alert_channels.telegram.room_id
message = format_message(alert, note)
await client.send_message(entity=room_id, message=message)
await tg_client.send_message(entity=room_id, message=message)
# if temp_client:
# await client.close()