Initial version of Telegram admin bot

This commit is contained in:
root
2026-02-07 21:34:24 +03:00
commit 492e3bd3cf
9 changed files with 1027 additions and 0 deletions

13
docker_watchdog.py Normal file
View File

@@ -0,0 +1,13 @@
import asyncio, subprocess
async def docker_watchdog(cfg, notify, bot, chat_id):
last = {}
while True:
for alias, real in cfg["docker"]["containers"].items():
state = subprocess.getoutput(
f"docker inspect -f '{{{{.State.Status}}}}' {real}"
)
if last.get(alias) != state:
await notify(bot, chat_id, f"🐳 {alias}: {state}")
last[alias] = state
await asyncio.sleep(120)