-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
103 lines (91 loc) · 3.78 KB
/
main.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
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
import requests, json, colorama, datetime, time
from colorama import Fore, init
init()
bio = False
pronouns = False
both = False
Reset = Fore.RESET
Magenta = Fore.MAGENTA
Black = Fore.LIGHTBLACK_EX
Green = Fore.GREEN
Red = Fore.RED
with open("config.json", "r") as file:
print(f"{Black}{datetime.datetime.now().strftime('%H:%M:%S')} -> {Magenta}[Info] Loading Config...{Reset}")
config = json.load(file)
token = config["Token"]
bio_1 = config["Bio_1"]
bio_2 = config["Bio_2"]
prounoun_1 = config["Pronoun_1"]
prounoun_2 = config["Pronoun_2"]
delay = int(config["Delay"])
print(f"{Black}{datetime.datetime.now().strftime('%H:%M:%S')} -> {Green}[Success] Done Loading Config{Reset}")
pronouns_or_bio = input(f"{Black}{datetime.datetime.now().strftime('%H:%M:%S')} -> {Magenta}[?] pronouns, bio or both?\n{Black}{datetime.datetime.now().strftime('%H:%M:%S')} -> {Magenta}[?] {Reset}")
if pronouns_or_bio == "bio":
bio = True
elif pronouns_or_bio == "pronouns":
pronouns = True
elif pronouns_or_bio == "both":
both = True
else:
print(f"{Black}{datetime.datetime.now().strftime('%H:%M:%S')} -> {Red}[Failed] Wrong input use 'pronouns', 'bio' or 'both'{Reset}")
time.sleep(2)
exit(0)
def update_bio(bio):
url = "https://discord.com/api/v9/users/@me/profile"
payload = {
"bio": bio
}
headers = {
"Authorization": f"{token}",
"Content-Type": "application/json"
}
response = requests.patch(url, headers=headers, json=payload)
if response.status_code == 200:
print(f"{Black}{datetime.datetime.now().strftime('%H:%M:%S')} -> {Green}[Success] Updated Bio to {bio}{Reset}")
else:
print(f"{Black}{datetime.datetime.now().strftime('%H:%M:%S')} -> {Red}[Failed] Failed updating bio to {bio} - {response.status_code}{Reset}")
def update_pronouns(pronouns):
url = "https://discord.com/api/v9/users/@me/profile"
payload = {
"pronouns": pronouns
}
headers = {
"Authorization": f"{token}",
"Content-Type": "application/json"
}
response = requests.patch(url, headers=headers, json=payload)
if response.status_code == 200:
print(f"{Black}{datetime.datetime.now().strftime('%H:%M:%S')} -> {Green}[Success] Updated Pronouns to {pronouns}{Reset}")
else:
print(f"{Black}{datetime.datetime.now().strftime('%H:%M:%S')} -> {Red}[Failed] Failed updating Pronouns to {pronouns} - {response.status_code}{Reset}")
def update_both(bio, pronouns):
url = "https://discord.com/api/v9/users/@me/profile"
payload = {
"bio": bio,
"pronouns": pronouns
}
headers = {
"Authorization": f"{token}",
"Content-Type": "application/json"
}
response = requests.patch(url, headers=headers, json=payload)
if response.status_code == 200:
print(f"{Black}{datetime.datetime.now().strftime('%H:%M:%S')} -> {Green}[Success] Updated Pronouns and Bio to {pronouns} and {bio}{Reset}")
else:
print(f"{Black}{datetime.datetime.now().strftime('%H:%M:%S')} -> {Red}[Failed] Failed updating Pronouns and bio to {pronouns} and {bio} - {response.status_code}{Reset}")
while True:
if bio == True:
update_bio(bio_1)
time.sleep(delay)
update_bio(bio_2)
time.sleep(delay)
elif pronouns == True:
update_pronouns(prounoun_1)
time.sleep(delay)
update_pronouns(prounoun_2)
time.sleep(delay)
elif both == True:
update_both(bio_1, prounoun_1)
time.sleep(delay)
update_both(bio_2, prounoun_2)
time.sleep(delay)