publish eve_orehold_watcher.py
This commit is contained in:
parent
5beca84cde
commit
d354ae1565
1 changed files with 3 additions and 14 deletions
|
|
@ -56,24 +56,13 @@ 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
|
||||
"""Show 'watcher online' by EDITING one message per source (no spam on restart).
|
||||
Defined here so every watcher (all import this module) shares it."""
|
||||
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
|
||||
_discord_live(cp, f"hb_{source}", "🟢 Watcher online", f"`{source}` on **{host}**")
|
||||
|
||||
|
||||
# --------------------------------------------------------------------------- #
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue