publish eve_orehold_watcher.py

This commit is contained in:
brockdarnold 2026-06-15 01:10:29 +00:00
parent 5beca84cde
commit d354ae1565

View file

@ -56,24 +56,13 @@ CONFIG_PATH = os.path.join(HERE, "config.ini")
def heartbeat(cp, source): def heartbeat(cp, source):
"""Post a one-line 'watcher online' to Discord so installs are verifiable at a """Show 'watcher online' by EDITING one message per source (no spam on restart).
glance. Deduped to at most once per 6h per source to avoid restart spam.""" Defined here so every watcher (all import this module) shares it."""
marker = os.path.join(HERE, f".hb_{source}")
try:
if os.path.exists(marker) and time.time() - os.path.getmtime(marker) < 6 * 3600:
return
except Exception:
pass
try: try:
host = socket.gethostname() host = socket.gethostname()
except Exception: except Exception:
host = "PC" host = "PC"
_discord(cp, "🟢 Watcher online", f"`{source}` running on **{host}**.") _discord_live(cp, f"hb_{source}", "🟢 Watcher online", f"`{source}` on **{host}**")
try:
with open(marker, "w") as f:
f.write(str(int(time.time())))
except Exception:
pass
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #