diff --git a/eve_orehold_watcher.py b/eve_orehold_watcher.py index d775fb9..5db5e05 100644 --- a/eve_orehold_watcher.py +++ b/eve_orehold_watcher.py @@ -32,6 +32,7 @@ import configparser import json import os import re +import socket import sys import time import urllib.request @@ -40,6 +41,27 @@ HERE = os.path.dirname(os.path.abspath(__file__)) CONFIG_PATH = os.path.join(HERE, "config.ini") +def heartbeat(cp, source): + """Post a one-line 'watcher online' to Discord so installs are verifiable at a + glance. Deduped to at most once per 6h per source to avoid restart spam.""" + 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: + host = socket.gethostname() + except Exception: + host = "PC" + _discord(cp, "🟢 Watcher online", f"`{source}` running on **{host}**.") + try: + with open(marker, "w") as f: + f.write(str(int(time.time()))) + except Exception: + pass + + # --------------------------------------------------------------------------- # # Config # --------------------------------------------------------------------------- # @@ -396,6 +418,7 @@ def main(): return mode = cp.get("watcher", "mode", fallback="ocr").strip().lower() print(f"=== eve_orehold_watcher starting (mode={mode}) ===") + heartbeat(cp, "orehold") if mode == "ocr": run_ocr(cp) elif mode == "timer":