def cmd_info(message, parameters, recursion=0):
async for msg in client.logs_from(message.channel, limit=25):
try:
if msg.attachments:
image = Image.open(BytesIO(requests.get(msg.attachments[0]['url']).content)).filter(ImageFilter.SHARPEN)
text = pytesseract.image_to_string(image)
if not text:
e = discord.Embed(colour=0xB5434E)
e.description = "I just forgot how to read..."
else:
e = discord.Embed(colour=0x43B581)
e.description = text
await client.send_message(message.channel, embed=e)
return
except OSError:
e = discord.Embed(colour=0xB5434E)
e.description = "Image way big, are you trying to kill me?"
await client.send_message(message.channel, embed=e)
return
except TypeError:
e = discord.Embed(colour=0xB5434E)
e.description = "Latest attachment is not a static image, try again."
await client.send_message(message.channel, embed=e)
return
except:
e = discord.Embed(colour=0xB5434E)
e.description = "Error ocurred, not related to OSError or TypeError I guess."
await client.send_message(message.channel, embed=e)
return
e = discord.Embed(colour=0xB5434E)
e.description = "I can't find an image in the last 25 posts, that or I'm retarded."
await client.send_message(message.channel, embed=e)
评论列表
文章目录