Created
November 15, 2024 18:09
-
-
Save 0xjmux/487f58e2fd75e3eb49ea29198496f53c to your computer and use it in GitHub Desktop.
Stupid-simple message sending to discord via webhook in 6 (really 3) lines of python
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
# Also see: https://support.discord.com/hc/en-us/articles/228383668-Intro-to-Webhooks | |
USERNAME = "Python Notifier" | |
WEBHOOK_URL = "" | |
def send_alert(contents: str): | |
data = {"content": contents, "username": USERNAME} | |
try: | |
requests.post(WEBHOOK_URL, json=data) | |
except Exception as e: | |
print(f"Error sending alert: {e}") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment