-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDiscordNotifEngine.py
33 lines (30 loc) · 1.19 KB
/
DiscordNotifEngine.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# Discord Notification Engine
# Written by ef1500
# This is meant to serve as a simple way to construct a simplistic embed from a single function so that way
# We can conserve space and neatly customize the embeds.
import json
import requests
#Generate an embed
def GenerateEmbed(Url, content, Title, Desc, Name, IconUrl, user):
data = {"content":content, "username": user}
# Content is an actual message, not in the embed, and the username is the username of the webhook
data["embeds"] = [
{
"title": Title, # Embed Title
"description": Desc, # Description of the embed (Put the text you want in the embed here)
"author": {
"name": Name, # The Author Name
"icon_url": IconUrl # The Url of the author icon
},
"color": 15406156, # Color of the embed
"footer": {
"text": "Powered by ef1500", # Footer Text
"icon_url": "https://imgur.com/nGQWo3C.png" # Footer Icon
}
}
]
sendNotif = requests.post(Url, json=data)
try:
sendNotif.raise_for_status()
except requests.exceptions.HTTPError as exx:
print(exx)