Files
hermes-recovery/scripts/send-reset-notifications.sh
T

27 lines
914 B
Bash
Executable File

#!/usr/bin/env bash
# Called BEFORE suggesting the user type /reset
# Notifies Anita and writes the startup flag for the new session
set -euo pipefail
ANITA_BOT_TOKEN="8797435889:AAER9zMnRHtAkTfVcifLdoPMu1XDPr6XkBk"
ANITA_CHAT_ID="8200236464"
# Write the "I'm back" flag for the new session to pick up
echo "$(date -u +%s)" > /root/.hermes/.just_reset
# 1. Notify Anita via Python (handles JSON/encoding properly)
python3 << 'PYEOF'
import requests, json
token = "8797435889:AAER9zMnRHtAkTfVcifLdoPMu1XDPr6XkBk"
chat_id = "8200236464"
msg = ("🔄 *Sho'Nuff is resetting in 2 minutes.*\n\n"
"Please finish any tasks you're working on. "
"I'll let you know when I'm back online.")
url = f"https://api.telegram.org/bot{token}/sendMessage"
data = {"chat_id": chat_id, "text": msg, "parse_mode": "Markdown"}
r = requests.post(url, data=data, timeout=10)
print(f"ANITA_STATUS={r.status_code}")
PYEOF