From 2ae7cbf3e90c0ba7568ff8baf841b83cb1e0ed62 Mon Sep 17 00:00:00 2001 From: tropii <97747461+TropiiDev@users.noreply.github.com> Date: Fri, 24 Nov 2023 19:39:55 -0500 Subject: [PATCH] Finished meme --- commands/meme.py | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/commands/meme.py b/commands/meme.py index fa366d2..fee133b 100644 --- a/commands/meme.py +++ b/commands/meme.py @@ -43,16 +43,18 @@ class meme(commands.Cog): async with session.get("https://reddit-meme.p.rapidapi.com/memes/trending") as response: response = requests.request("GET", url, headers=headers) - await ctx.send(response.json()) -""" - json_data = json.loads(response.text) - new_data = json_data[0] - title = new_data["title"] - image = new_data["url"] - em = discord.Embed(title=title, color=ctx.author.color) - em.set_image(url=image) - await ctx.send(embed=em) -""" + json_data = json.loads(response.text) + description = json_data["description"] + url = json_data["url"] + + embed = discord.Embed( + title="Meme", + description=description, + color=ctx.author.color + ) + embed.set_image(url=url) + await ctx.send(embed=embed) + async def setup(bot): await bot.add_cog(meme(bot)) \ No newline at end of file