|
|
@ -8,7 +8,6 @@ from discord.ext import commands, tasks |
|
|
|
from discord.ext.commands import has_permissions, MissingPermissions |
|
|
|
from dotenv import load_dotenv |
|
|
|
import aiohttp |
|
|
|
from unidecode import unidecode |
|
|
|
|
|
|
|
# import subprocess |
|
|
|
|
|
|
@ -37,13 +36,8 @@ async def on_message(message): |
|
|
|
if len(message.attachments) > 0: |
|
|
|
if not message.attachments[0].url.endswith( |
|
|
|
('.png', '.jpg', '.jpeg', '.mp4', '.mov', '.avi', '.gif', '.image', '.svg')): |
|
|
|
download = message.attachments[0].url |
|
|
|
async with aiohttp.ClientSession() as session: |
|
|
|
async with session.get(download, allow_redirects=True) as r: |
|
|
|
|
|
|
|
# r = requests.get(download, allow_redirects=True) |
|
|
|
text = await r.text() |
|
|
|
text = unidecode(text) |
|
|
|
text = await discord.Attachment.read(message.attachments[0], use_cached=False) |
|
|
|
text = text.decode('Latin-1') |
|
|
|
text = "\n".join(text.splitlines()) |
|
|
|
if '�' not in text: # If it's not an image/gif |
|
|
|
truncated = False |
|
|
@ -60,6 +54,7 @@ async def on_message(message): |
|
|
|
embed_var = discord.Embed(title="Please use a paste service", color=0x1D83D4) |
|
|
|
embed_var.description = response |
|
|
|
await message.channel.send(embed=embed_var) |
|
|
|
logging.info(f'File uploaded by {message.author} ({message.author.id}): https://bin.birdflop.com/{key}') |
|
|
|
timings = bot.get_cog('Timings') |
|
|
|
await timings.analyze_timings(message) |
|
|
|
await bot.process_commands(message) |
|
|
|