mirror of
https://github.com/nexy7574/LCC-bot.git
synced 2024-09-19 18:16:34 +01:00
reFix starboard not attaching images properly
This commit is contained in:
parent
c0b1155b30
commit
29c8ecb19f
1 changed files with 9 additions and 11 deletions
|
@ -55,8 +55,6 @@ class StarBoardCog(commands.Cog):
|
||||||
star_count = 0
|
star_count = 0
|
||||||
else:
|
else:
|
||||||
star_count = star_count[0].count
|
star_count = star_count[0].count
|
||||||
# noinspection PyUnresolvedReferences
|
|
||||||
cap = (message.channel if "thread" in message.channel.type.name else message.guild).member_count * 0.1
|
|
||||||
embed = discord.Embed(colour=discord.Colour.gold(), timestamp=message.created_at, description=message.content)
|
embed = discord.Embed(colour=discord.Colour.gold(), timestamp=message.created_at, description=message.content)
|
||||||
embed.set_author(
|
embed.set_author(
|
||||||
name=message.author.display_name, url=message.jump_url, icon_url=message.author.display_avatar.url
|
name=message.author.display_name, url=message.jump_url, icon_url=message.author.display_avatar.url
|
||||||
|
@ -99,16 +97,16 @@ class StarBoardCog(commands.Cog):
|
||||||
else:
|
else:
|
||||||
embed.fields[1].value += textwrap.shorten(ref.content, 1024 - len(field.value), placeholder="...")
|
embed.fields[1].value += textwrap.shorten(ref.content, 1024 - len(field.value), placeholder="...")
|
||||||
|
|
||||||
if message.attachments:
|
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 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"):
|
||||||
if file.content_type.startswith("image") and embed.image is discord.Embed.Empty:
|
if embed.image.url is discord.Embed.Empty:
|
||||||
embed.set_image(url=file.url)
|
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
|
||||||
|
|
Loading…
Reference in a new issue