Discord cleanup tool
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
rmds/main.py

90 lines
2.1 KiB

4 years ago
#!/usr/bin/python
import re
import discord as ds
4 years ago
from lib.input import *
# very important art :)
art = """
\033[1m_________________________________\033[0m
\033[1m<\033[0m \033[96m\033[1mrmds\033[0m \033[1mv\033[0m\033[92m1.0\033[0m: \033[4mDiscord Cleanup Tool\033[0m \033[1m>\033[0m
\033[1m---------------------------------\033[0m
\ ^__^
\ (oo)\_______
(__)\ )\/
||----w |
|| ||
"""
print(art)
4 years ago
# reading the auth token
authfile = open("auth.txt", "r")
authToken = authfile.readlines()[0]
c = ds.Client()
async def get_target_server(c):
4 years ago
inp = get_value_of_key("-i") or input("Input target server: ")
4 years ago
target = c.get_guild(int(inp))
if( target != None ):
await attack_server(target, c)
4 years ago
await c.close()
4 years ago
else:
print(f"\nUnknown server {inp}")
print(f"Target Object: {target}")
return await get_target_server(c)
@c.event
async def on_ready():
4 years ago
print(f"\033[92mLogged in as: {c.user}\033[0m")
4 years ago
await get_target_server(c)
async def attack_server(server, c):
4 years ago
print(f"Wiping server: \033[1m {server} \033[0m")
if( not key_valid("--noask") ):
print(f"\nAll of your messages in \033[1m{server}\033[0m will be \033[1m\033[91mDELETED FOREVER\033[0m!\033[0m")
ask = input("Are you sure?! (y/n): ")
if( not ask == "y" ):
print("Aborting...")
return
4 years ago
for channel in server.channels:
if( str(channel.type) == "text" ):
try:
await send_payload(channel, c)
4 years ago
except Exception as err:
print(f"Unable to wipe channel: {channel} err: {err}")
4 years ago
pass
4 years ago
async def get_user_messages(channel, c):
4 years ago
messages = await channel.history(limit=9999).flatten()
4 years ago
for m in messages:
if( m.author != c.user ):
messages.remove(m)
return messages, len(messages)
async def send_payload(channel, c):
user_messages, user_messages_len = await get_user_messages(channel, c)
print(f"\n\t\t#{channel}")
for i, m in enumerate(user_messages):
4 years ago
try:
4 years ago
print(f"[{i+1}/{user_messages_len}]\t \033[1m\033[91mrm\033[0m \t({m.id}) : \"{m.content}\"")
except Exception as err:
print(f"err: {err}")
4 years ago
pass
4 years ago
4 years ago
c.run(authToken, bot=False)