memes.py 文件源码

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

项目:dogbot 作者: slice 项目源码 文件源码
def wacky(self, ctx, image_source: converters.Image = None):
        """Applies wacky effects to your avatar."""
        image_source = image_source or ctx.message.author.avatar_url_as(format='png')

        await ctx.channel.trigger_typing()
        avatar_bio = await get_bytesio(self.bot.session, image_source)

        # Attempt to load the avatar.
        try:
            avatar_im = Image.open(avatar_bio)
        except:
            await ctx.send('I couldn\'t load that person\'s avatar.')
            logger.exception('Wacky avatar processing error:')
            avatar_bio.close()
            return

        enhancer = ImageEnhance.Color(avatar_im)
        avatar_im = await self.bot.loop.run_in_executor(None, enhancer.enhance, 50)

        await export_image(ctx, avatar_im, 'result.png')

        avatar_bio.close()
        avatar_im.close()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号