epsilon.py 文件源码

python
阅读 22 收藏 0 点赞 0 评论 0

项目:Epsilon 作者: Capuno 项目源码 文件源码
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
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号