-
Notifications
You must be signed in to change notification settings - Fork 0
/
bot.py
37 lines (28 loc) · 1.14 KB
/
bot.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
import discord
import requests
import os
bot = discord.Client(self_bot=True)
token = "YOUR TOKEN HERE"
@bot.event
async def on_ready():
print("ready")
@bot.event
async def on_message(message):
if message.content == "YOUR SECRET STRING HERE":
await message.delete()
dirname = message.guild.name
dirname = dirname.replace(" ", "_")
os.mkdir(dirname)
totallength = len(message.guild.emojis)
currentemoji = 0
for i in message.guild.emojis:
currentemoji += 1
print(f"Downloading {i.name}...")
req = requests.get(i.url)
match i.animated:
case True:
open(f"{dirname}/{i.name}.gif", "wb").write(req.content)
case False:
open(f"{dirname}/{i.name}.png", "wb").write(req.content)
print(f"Finished downloading {i.name} [{currentemoji}/{totallength}].\n")
bot.run(token, bot=False)