-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.py
31 lines (23 loc) · 901 Bytes
/
index.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
import os
from PIL import Image, ImageSequence
import discord
from config import TOKEN
client = discord.Client()
@client.event
async def on_message(message):
if message.author != client.user:
return
for filename in os.listdir("emojis"):
file, ext = filename.split(".")
if message.content == f":{file}:":
filename = file + '.' + ext
im = Image.open(os.path.join("emojis", filename))
im = im.resize((48,48))
if (ext == "gif"):
im.save(os.path.join("emojis", filename), save_all=True)
else:
im.save(os.path.join("emojis", filename))
await message.delete()
await message.channel.send(file=discord.File(os.path.join('emojis', filename)))
print(f"used :{file}:")
client.run(TOKEN, bot=False)