Allow multiple images on pins, closes #161

This commit is contained in:
Zeva Rose 2023-08-27 15:13:04 -06:00
parent 4343b67abd
commit 66e39cbea9

View file

@ -228,13 +228,12 @@ class PinboardCog(Extension):
content = message.content content = message.content
attachments = message.attachments attachments = message.attachments
image_url = None image_urls = []
if attachments: if attachments:
for attachment in attachments: for attachment in attachments:
if attachment.content_type in supported_images: if attachment.content_type in supported_images:
image_url = attachment.url image_urls.append(attachment.url)
break if not content and len(image_urls) > 0:
if not content and image_url:
content = "\u200b" content = "\u200b"
embed = build_embed( embed = build_embed(
@ -250,8 +249,8 @@ class PinboardCog(Extension):
icon_url=message.author.avatar.url, icon_url=message.author.avatar.url,
) )
embed.set_footer(text=ctx.guild.name + " | " + channel.name) embed.set_footer(text=ctx.guild.name + " | " + channel.name)
if image_url: if len(image_urls) > 0:
embed.set_image(url=image_url) embed.set_images(*image_urls)
star_components = Button( star_components = Button(
style=ButtonStyle.DANGER, style=ButtonStyle.DANGER,
emoji="🗑️", emoji="🗑️",