mirror of
https://forgejo.altau.su/lego/lego-monitoring.git
synced 2026-03-10 04:41:10 +00:00
try to use OK alerts to reflect successful checks
This commit is contained in:
parent
d59d5ac4e2
commit
5f9952314d
8 changed files with 22 additions and 17 deletions
|
|
@ -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()
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue