From f3c27ae5632a8100ee883b9b91f106c1592c6446 Mon Sep 17 00:00:00 2001 From: haunter Date: Fri, 8 Aug 2025 18:38:21 +0000 Subject: [PATCH] Add notify.py --- notify.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 notify.py diff --git a/notify.py b/notify.py new file mode 100644 index 0000000..887e40c --- /dev/null +++ b/notify.py @@ -0,0 +1,21 @@ +import requests + +# ✅ Your Discord webhook URL +WEBHOOK_URL = "https://discord.com/api/webhooks/847569410839150662/lJo0y5aah72zj-ML-9jMMAEPzD5M0gafC4xUe2d5HlKZaW0Z187wjCW912fmJqV5c74a" + +def hooknotify(server_time, title, resource, surplus): + """Send Discord notification with surplus info.""" + message = ( + "```yaml\n" + f"{server_time} | {title} | {resource} surplus: {surplus}\n" + "```" + ) + data = { "content": message } + try: + response = requests.post(WEBHOOK_URL, json=data) + if response.status_code == 204: + print(f"📨 Notification sent for {resource}") + else: + print(f"⚠️ Failed to send notification: {response.status_code}") + except Exception as e: + print("❌ Error sending notification:", e)