import io

import aiohttp
from discord.ext import commands
import yaml


class Cat:
    def __init__(self, bot):
        self.bot = bot
        with open('config.yaml') as file:
            data = yaml.load(file)
        self.key = data.get('cat_key', '')
        self.url = 'http://thecatapi.com/api/images/get'
        self.params = {'api_key': self.key,
                       'type': 'png,jpg'}

    @commands.command()
    async def cat(self, ctx):
        s = self.bot.session
        async with ctx.typing(), s.get(self.url, params=self.params) as resp:
            image = io.BytesIO(await resp.content.read())
            ext = resp.headers['Content-Type'].partition('/')[2]
        await ctx.send(file=image, filename=f'{ctx.message.id}.{ext}')


def setup(bot):
    bot.add_cog(Cat(bot))

@@ -22,16 +22,32 @@
 iohttp%0D%0A
+import discord%0D%0A
 from dis
@@ -72,16 +72,40 @@
 mmands%0D%0A
+from lxml import etree%0D%0A
 import y
@@ -445,16 +445,83 @@
 png,jpg'
+,%0D%0A                       'format': 'xml',%0D%0A                       
 %7D%0D%0A%0D%0A   
@@ -582,16 +582,22 @@
        s
+ession
  = self.
@@ -644,11 +644,41 @@
 ng()
-, s
+:%0D%0A            async with session
 .get
@@ -734,50 +734,51 @@
     
-image = io.BytesIO(await resp.content.read
+    root = etree.fromstring(await resp.text
 ())%0D
@@ -794,132 +794,152 @@
     
-ext
+url
  = r
-esp.headers%5B'Content-Type'%5D.partition('/')%5B2%5D%0D%0A        await ctx.send(file=image, filename=f'%7Bctx.message.id%7D.%7Bext%7D')
+oot.find('.//url').text%0D%0A            embed = discord.Embed()%0D%0A            embed.set_image(url=url)%0D%0A        await ctx.send(embed=embed)%0D%0A
 %0D%0A%0D%0A

Send image in embed because aiohttp doesn't know how to parse links