discord / discord-api-docs

Official Discord API Documentation
https://discord.com/developers/docs/intro
Other
5.84k stars 1.23k forks source link

Uploading an apng strips it of all it's frames #6971

Open Sukuratchi opened 5 days ago

Sukuratchi commented 5 days ago

Description

When I try to upload an apng as a sticker using my discord.py bot, it seems to only upload the first frame.

Code that I had:

@app_commands.command(name='addsticker', description='Add a sticker')
async def addsticker(self, interaction: discord.Interaction, stickername: str, relatedemoji: str, stickerimg: discord.Attachment, description: str = ""):
    sticker = await stickerimg.to_file()

    await interaction.guild.create_sticker(name=stickername, description=description, emoji=relatedemoji, file=sticker)
    logger.info(f"Added {stickerimg} as a sticker")
    await interaction.response.send_message('Added successfully!', ephemeral=True)

I've tried uploading .png as well as .apng just in case, always the same behavior

This is my first ever issue like this so please lmk if I missed any details that I should've provided

Steps to Reproduce

Try uploading an animated .png as a sticker to a server using a bot

Expected Behavior

It should return the full .png with all it's frames

Current Behavior

It returns with only the first frame of the animated .png

Screenshots/Videos

2024-07-03 14-46-38(1).webm

Client and System Information

discord.py 2.3.2 python 3.12 windows 11 23h2 enterprise build 22631.3810

Rodentman87 commented 5 days ago

I was able to reproduce the behavior here, but the conversion is happening when it's uploaded as part of the command, rather than when it's being uploaded for the sticker. I was able to upload an apng sticker with a direct api call using the file directly. Attachments for slash commands are processed by our media proxy, which doesn't support apng files, so this is working as expected.

Sukuratchi commented 5 days ago

I was able to upload an apng sticker with a direct api call using the file directly.

So basically as long as I do a "direct" upload, should work fine?

Rodentman87 commented 5 days ago

correct, as long as you're uploading the apng file directly instead of the one downloaded from our media proxy, it should work correctly