feat: Support GIF format in sticker description generation

This commit is contained in:
Slipstream 2025-05-29 11:46:40 -06:00
parent 8856ff17e5
commit 0858185456
Signed by: slipstream
GPG Key ID: 13E498CE010AC6FD

View File

@ -311,7 +311,12 @@ class GurtCog(commands.Cog, name="Gurt"): # Added explicit Cog name
print(f"Generating description for sticker: {sticker.name} (ID: {sticker.id}) in guild ID {guild_id}") print(f"Generating description for sticker: {sticker.name} (ID: {sticker.id}) in guild ID {guild_id}")
description_to_add = "No description generated." description_to_add = "No description generated."
if sticker.format == discord.StickerFormatType.png or sticker.format == discord.StickerFormatType.apng or sticker.format == discord.StickerFormatType.gif: if sticker.format == discord.StickerFormatType.png or sticker.format == discord.StickerFormatType.apng or sticker.format == discord.StickerFormatType.gif:
mime_type = "image/png" format_to_mime = {
discord.StickerFormatType.png: "image/png",
discord.StickerFormatType.apng: "image/apng",
discord.StickerFormatType.gif: "image/gif",
}
mime_type = format_to_mime.get(sticker.format, "image/png")
description = await api.generate_image_description(self, sticker_url, sticker.name, "sticker", mime_type) description = await api.generate_image_description(self, sticker_url, sticker.name, "sticker", mime_type)
description_to_add = description or "No description generated." description_to_add = description or "No description generated."
elif sticker.format == discord.StickerFormatType.lottie: elif sticker.format == discord.StickerFormatType.lottie: