mirror of
https://github.com/nexy7574/LCC-bot.git
synced 2024-09-19 18:16:34 +01:00
Fix starboard not attaching images properly
This commit is contained in:
parent
fd300e8a51
commit
5549f05494
1 changed files with 4 additions and 4 deletions
|
@ -22,7 +22,7 @@ class StarBoardCog(commands.Cog):
|
||||||
async with httpx.AsyncClient(
|
async with httpx.AsyncClient(
|
||||||
headers={
|
headers={
|
||||||
"User-Agent": "Mozilla/5.0 (Windows NT 10.69; Win64; x64) "
|
"User-Agent": "Mozilla/5.0 (Windows NT 10.69; Win64; x64) "
|
||||||
"LCC-Bot-Scraper/0 (https://github.com/EEKIM10/LCC-bot)"
|
"LCC-Bot-Scraper/0 (https://github.com/nexy7574/LCC-bot)"
|
||||||
}
|
}
|
||||||
) as session:
|
) as session:
|
||||||
image = starboard_message.embeds[0].image
|
image = starboard_message.embeds[0].image
|
||||||
|
@ -103,14 +103,14 @@ class StarBoardCog(commands.Cog):
|
||||||
for file in message.attachments:
|
for file in message.attachments:
|
||||||
name = f"Attachment #{message.attachments.index(file)}"
|
name = f"Attachment #{message.attachments.index(file)}"
|
||||||
spoiler = file.is_spoiler()
|
spoiler = file.is_spoiler()
|
||||||
if not spoiler and file.url.lower().endswith(("png", "jpeg", "jpg", "gif", "webp")) and not embed.image:
|
|
||||||
embed.set_image(url=file.url)
|
|
||||||
if spoiler:
|
if spoiler:
|
||||||
embed.add_field(name=name, value=f"||[{file.filename}]({file.url})||", inline=False)
|
embed.add_field(name=name, value=f"||[{file.filename}]({file.url})||", inline=False)
|
||||||
else:
|
else:
|
||||||
|
if file.content_type.startswith("image") and embed.image is discord.Embed.Empty:
|
||||||
|
embed.set_image(url=file.url)
|
||||||
embed.add_field(name=name, value=f"[{file.filename}]({file.url})", inline=False)
|
embed.add_field(name=name, value=f"[{file.filename}]({file.url})", inline=False)
|
||||||
|
|
||||||
embed.set_footer(text="Starboard threshold for this message was {:.2f}.".format(cap))
|
# embed.set_footer(text="Starboard threshold for this message was {:.2f}.".format(cap))
|
||||||
return embed
|
return embed
|
||||||
|
|
||||||
@commands.Cog.listener("on_raw_reaction_add")
|
@commands.Cog.listener("on_raw_reaction_add")
|
||||||
|
|
Loading…
Reference in a new issue