discord bot python meme command

Solutions on MaxInterview for discord bot python meme command by the best coders in the world

showing results for - "discord bot python meme command"
Tania
07 Jan 2018
1@client.command(pass_context=True)
2async def meme(ctx):
3    embed = discord.Embed(title="", description="")
4
5    async with aiohttp.ClientSession() as cs:
6        async with cs.get('https://www.reddit.com/r/dankmemes/new.json?sort=hot') as r:
7            res = await r.json()
8            embed.set_image(url=res['data']['children'] [random.randint(0, 25)]['data']['url'])
9            await ctx.send(embed=embed)
10