Upload URLs instead of attachments (testing needed)

This commit is contained in:
Zeva Rose 2021-08-03 00:31:40 -06:00
parent 99282874bb
commit be96014447

View file

@ -60,10 +60,11 @@ class ModlogMessageCog(commands.Cog):
] ]
if message.attachments: if message.attachments:
value = "\n".join([x.url for x in message.attachments])
fields.append( fields.append(
Field( Field(
name="Attachments", name="Attachments",
value=f"{len(message.attachments)}", value=value,
inline=False, inline=False,
) )
) )
@ -76,12 +77,6 @@ class ModlogMessageCog(commands.Cog):
color="#fc9e3f", color="#fc9e3f",
) )
add_file = False
if message.attachments:
if "image" in message.attachments[0].content_type:
embed.set_image(url=message.attachments[0].url)
else:
add_file = True
embed.set_author( embed.set_author(
name=message.author.name, name=message.author.name,
icon_url=message.author.avatar_url, icon_url=message.author.avatar_url,
@ -91,9 +86,4 @@ class ModlogMessageCog(commands.Cog):
text=f"{message.author.name}#{message.author.discriminator}" text=f"{message.author.name}#{message.author.discriminator}"
+ f" | {message.author.id}" + f" | {message.author.id}"
) )
if not add_file: await channel.send(embed=embed)
await channel.send(embed=embed)
else:
await channel.send(
embed=embed, file=(await message.attachments[0].to_file())
)