images.py 文件源码

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

项目:lagbot 作者: mikevb1 项目源码 文件源码
def cat(self, ctx):
        """Get a random cat image."""
        with ctx.typing():
            try:
                image_url = await self.fetch_cat()
            except NotFound as e:
                await ctx.send(e)
                return

            try:
                fact = (await self.fetch_facts(1))[0]
            except NotFound as e:
                fact = ''

            embed = discord.Embed(description=fact or None)
            embed.set_image(url=image_url)
        try:
            await ctx.send(embed=embed)
        except discord.HTTPException:
            embed = discord.Embed(description=fact or None)
            embed.set_footer(text='Failed getting a cat image.')
            await ctx.send(embed=embed)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号