diff options
-rw-r--r-- | bot/exts/easter/earth_photos.py | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/bot/exts/easter/earth_photos.py b/bot/exts/easter/earth_photos.py index e3d5936e..0ac470ce 100644 --- a/bot/exts/easter/earth_photos.py +++ b/bot/exts/easter/earth_photos.py @@ -18,19 +18,27 @@ class EarthPhotos(commands.Cog): async def earth_photos(self, ctx: commands.Context) -> None: """Returns a random photo of earth, sourced from Unsplash.""" async with ctx.typing(): - async with aiohttp.ClientSession as session: + async with aiohttp.ClientSession() as session: async with session.get( 'https://api.unsplash.com/photos/random?query=earth&client_id=' + UnClient_id) as r: jsondata = await r.json() linksdata = jsondata.get("urls") embedlink = linksdata.get("full") downloadlinksdata = jsondata.get("links") + userdata = jsondata.get("user") + username = userdata.get("name") + userlinks = userdata.get("links") + profile = userlinks.get("html") async with session.get( downloadlinksdata.get("download_location") + "?client_id=" + UnClient_id) as er: - er.status() - embed = discord.Embed(title="In progress") - embed.set_photo(url=embedlink) - await ctx.send(embed=embed) + er.status + embed = discord.Embed( + title="Earth Photo", + description="A photo of earth from Unsplash.", + color=0x66ff00) + embed.set_image(url=embedlink) + embed.add_field(title="Author", value="Made by [" + username + "](" + profile + ") on Unsplash.") + await ctx.send(embed=embed) def setup(bot: commands.Bot) -> None: |