-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathautobump_no_gui.py
121 lines (95 loc) · 3.46 KB
/
autobump_no_gui.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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
import requests
import json
import random
import time
try:
with open("config.json") as config_file:
config = json.load(config_file)
except FileNotFoundError:
config = {
"guild_id": "",
"channel_id": "",
"token": "",
"password": "",
"email": "",
"total_seconds_min": "",
"total_seconds_max": ""
}
with open("config.json", 'w') as config_file:
json.dump(config, config_file, indent=4)
input("Config.json file cannot be empty.")
quit()
with open('config.json') as config_file:
try:
config = json.load(config_file)
guild_id = int(config.get('guild_id'))
channel_id = int(config.get('channel_id'))
token = config.get('token')
password = config.get('password')
email = config.get('email')
total_seconds_min = int(config.get('total_seconds_min'))
total_seconds_max = int(config.get('total_seconds_max'))
except:
input("Correctly fill config.json.")
quit()
data = {
"type": 2,
"application_id": "302050872383242240",
"guild_id": guild_id,
"channel_id": channel_id,
"session_id": "bf8e7c1a2585bfe2ffa58e2eec2a350e",
"data": {
"version": "1051151064008769576",
"id": "947088344167366698",
"name": "bump",
"type": 1,
"options": [],
"application_command": {
"id": "947088344167366698",
"application_id": "302050872383242240",
"version": "1051151064008769576",
"default_member_permissions": None,
"type": 1,
"nsfw": False,
"name": "bump",
"description": "Pushes your server to the top of all your server's tags and the front page",
"description_localized": "Bumper ce serveur",
"dm_permission": True,
"contexts": None
}
}
}
headers = {
'Authorization': token,
'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/110.0.0.0 Safari/537.36',
'Content-Type': 'application/json'
}
def bump(guild_id, channel_id, token, password, email):
verif = requests.get('https://discord.com/api/v9/users/@me', headers=headers)
if verif.status_code == 200:
pass
else:
tpayload = {"email": email, "password": password}
theaders = {"Content-Type": "application/json"}
r = requests.post("https://discord.com/api/v9/auth/login", headers=theaders, json=tpayload)
if r.status_code == 200:
token = r.json()["token"]
headers["Authorization"] = token
config["token"] = token
with open("config.json", 'w') as config_file:
json.dump(config, config_file, indent=4)
else:
print("Error, Failed to log in. Check your credentials.", r.status_code, r.text)
return
response = requests.post("https://discord.com/api/v9/interactions", headers=headers, data=json.dumps(data))
if response.status_code == 204:
print("Successfully sent bump.")
elif '"code": 10004' in response.text:
print("Guild ID not found.")
elif '"code": 10003' in response.text:
print("Channel ID not found.")
else:
print("Failed to send bump :" + response.text + " " + str(response.status_code))
while True:
bump(guild_id, channel_id, token, password, email)
time.sleep(random.randint(total_seconds_min, total_seconds_max))