Lately I have been making a discord bot with python, and I wanted to add reddit commands, as I've seen with bots like Dank Memer, MEE6, and others send image posts from reddit. I found some code online (I'm pretty new to discord.py) and I found how to do this with aiohttp
async def meme(ctx):
embed = discord.Embed(title="Post from r/memes.", description=None, color=0xff0000)
async with aiohttp.ClientSession() as cs:
async with cs.get('https://www.reddit.com/r/memes/new.json?sort=hot') as r:
res = await r.json()
embed.set_image(url=res['data']['children'] [random.randint(0, 25)]['data']['url'])
await ctx.send(embed=embed, content=None)
The only problem with this is that I haven't figured out how to also add the url of the post so that the user can visit it.