1
0
Fork 0
mirror of synced 2024-05-04 12:42:30 +12:00

Implement credit to source

This commit is contained in:
Dan Hess 2020-12-05 22:13:53 -06:00
parent 7ea58f4ccc
commit 3ba4a41854

View file

@ -16,19 +16,19 @@ class Images(commands.Cog):
try: try:
url = data["data"]["file_url_size_large"] url = data["data"]["file_url_size_large"]
filename = data["data"]["file_name"] credit = data["data"]["file_source_url"]
except (KeyError, TypeError): except (KeyError, TypeError):
return await ctx.send( return await ctx.send(
f"I couldn't connect! Sorry no {animal}s right now ;w;" f"I couldn't connect! Sorry no {animal}s right now ;w;"
) )
else: else:
image = await utils.download_image(url) e = discord.Embed(title="Source", url=credit)
f = discord.File(image, filename=filename) e.set_image(url=url)
try: try:
await ctx.send(file=f) await ctx.send(embed=e)
except discord.HTTPException: except discord.HTTPException:
await ctx.send( await ctx.send(
f"File to large to send as attachment, here is the URL: {url}" f"File too large to send as attachment, here is the URL: {url}"
) )
@commands.command(aliases=["rc"]) @commands.command(aliases=["rc"])