First version

pull/1/head
E. Almqvist 4 years ago
parent 896ee7340c
commit a03e22658a
  1. 10
      lib/input.py
  2. 61
      main.py

@ -0,0 +1,10 @@
import sys
def get_value_of_key(key): # get the value of an input key, example: -c {VALUE}
for i in sys.argv:
if( i == key ):
return sys.argv[sys.argv.index(key) + 1]
return None # if no value was found return -1
def key_valid(key):
return key in sys.argv

@ -2,6 +2,22 @@
import re import re
import discord as ds import discord as ds
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)
# reading the auth token # reading the auth token
authfile = open("auth.txt", "r") authfile = open("auth.txt", "r")
@ -10,14 +26,12 @@ authToken = authfile.readlines()[0]
c = ds.Client() c = ds.Client()
async def get_target_server(c): async def get_target_server(c):
inp = input("Input target server: ") inp = get_value_of_key("-i") or input("Input target server: ")
target = c.get_guild(int(inp)) target = c.get_guild(int(inp))
if( target != None ): if( target != None ):
await attack_server(target, c) await attack_server(target, c)
await c.close()
print("\nDone.")
await exit(0)
else: else:
print(f"\nUnknown server {inp}") print(f"\nUnknown server {inp}")
print(f"Target Object: {target}") print(f"Target Object: {target}")
@ -26,31 +40,50 @@ async def get_target_server(c):
@c.event @c.event
async def on_ready(): async def on_ready():
print(f"Logged in as: {c.user}") print(f"\033[92mLogged in as: {c.user}\033[0m")
await get_target_server(c) await get_target_server(c)
async def attack_server(server, c): async def attack_server(server, c):
print(f"Wiping server: {server.id}") 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
for channel in server.channels: for channel in server.channels:
if( str(channel.type) == "text" ): if( str(channel.type) == "text" ):
try: try:
await send_payload(channel, c) await send_payload(channel, c)
except: except Exception as err:
print(f"Unable to wipe channel: {channel}") print(f"Unable to wipe channel: {channel} err: {err}")
pass pass
async def send_payload(channel, c): async def get_user_messages(channel, c):
print(f"Removing messages from channel: {channel}")
messages = await channel.history(limit=9999).flatten() messages = await channel.history(limit=9999).flatten()
async for m in messages: 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):
try: try:
if( m.author == c.user ): print(f"[{i+1}/{user_messages_len}]\t \033[1m\033[91mrm\033[0m \t({m.id}) : \"{m.content}\"")
print(f"Deleting message: {m}") except Exception as err:
except: print(f"err: {err}")
pass pass
c.run(authToken, bot=False) c.run(authToken, bot=False)

Loading…
Cancel
Save