-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathWebhookSendTkinter.py
More file actions
81 lines (52 loc) · 1.82 KB
/
WebhookSendTkinter.py
File metadata and controls
81 lines (52 loc) · 1.82 KB
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#!/usr/bin/env python3
from tkinter import *
from functools import partial
import requests #dependency
def validateLogin(title, body, username, url, desc):
username = username
url = url.get()
data = {
"username": username.get()
}
data["embeds"] = [
{
"description": desc.get(),
"title": title.get()
}
]
result = requests.post(url, json=data)
try:
result.raise_for_status()
except requests.exceptions.HTTPError as err:
print(err)
else:
print("Payload delivered successfully, code {}.".format(result.status_code))
return
#window
tkWindow = Tk()
tkWindow.geometry('400x150')
tkWindow.title('Discord webhook send')
#Title of webhhok message
titleLabel = Label(tkWindow, text="Title").grid(row=0, column=0)
title = StringVar()
TtitleEntry = Entry(tkWindow, textvariable=title).grid(row=0, column=1)
#Body of webhhok message
bodyLabel = Label(tkWindow, text="body").grid(row=3, column=0)
body = StringVar()
bodyEntry = Entry(tkWindow, textvariable=body).grid(row=3, column=1)
#username of webhhok bot
usernameLabel = Label(tkWindow, text="Username").grid(row=3, column=2)
username = StringVar()
usernameEntry = Entry(tkWindow, textvariable=username).grid(row=3, column=3)
#url of webhhok bot
urlLabel = Label(tkWindow, text="url du webhook").grid(row=4, column=0)
url = StringVar()
urlEntry = Entry(tkWindow, textvariable=url).grid(row=4, column=1)
#desc of webhhok message
descLabel = Label(tkWindow, text="desc du webhook").grid(row=5, column=0)
desc = StringVar()
descEntry = Entry(tkWindow, textvariable=desc).grid(row=5, column=1)
validateLogin = partial(validateLogin, title, body, username, url, desc)
#login button
loginButton = Button(tkWindow, text="Login", command=validateLogin).grid(row=10, column=1)
tkWindow.mainloop()