A simple and easy way of doing it, it will randomly choose a image link out of the "images" array and display it as an image url in the embed.
images = ['https://i.redd.it/123123.jpg', 'etc', 'image link', 'etc', 'image link', 'etc']
@client.command()
async def image(ctx):
embed = discord.Embed(
title="Random Image",
colour=discord.Colour(0x7289DA),
description=f"Random Image",
timestamp=datetime.datetime.utcfromtimestamp(1580842764)
)
embed.set_image(url=(random.choice(images)))
await ctx.send(embed = embed)
Getting more advanced, you can use api's or json file which allow you to take images from other resources online such as:
embed = discord.Embed(title="r/dankmemes", description="https://www.reddit.com")
async with aiohttp.ClientSession() as cs:
async with cs.get(
'https://www.reddit.com/r/dankmemes/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)
But leave that up to you, hope this helps
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…