def cmd_info(message, parameters, recursion=0):
await client.send_typing(message.channel)
async for msg in client.logs_from(message.channel, limit=25):
try:
if msg.attachments:
img = Image.open(BytesIO(requests.get(msg.attachments[0]['url']).content)).convert('RGB')
neg = ImageOps.invert(img)
neg.save("tmp/negative.png","PNG")
img.save("tmp/positive.png","PNG")
frames = [imageio.imread("tmp/negative.png"), imageio.imread("tmp/positive.png")]
imageio.mimsave("tmp/epilepsy.gif", frames, duration=0.07)
with open("tmp/epilepsy.gif", "rb") as outputGif:
await client.send_file(message.channel, outputGif, filename="epilepsy.gif")
os.system("rm tmp/epilepsy.gif tmp/negative.png tmp/positive.png")
return
except Exception as e:
e = discord.Embed(colour=0xB5434E)
e.description = "Error ocurred, 2 lazy to check what was it, try again later."
await client.send_message(message.channel, embed=e)
return
评论列表
文章目录