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)
评论列表
文章目录