Implement credit to source
This commit is contained in:
parent
7ea58f4ccc
commit
3ba4a41854
|
@ -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"])
|
||||||
|
|
Loading…
Reference in a new issue