Search code examples
discord

Discord update attachment URLs


There is a discord bot (C# discord.net), which has several slash commands for adding and receiving gif / img.

Added attachments are stored in the database as a link; links to attachement have an expiration date (like 24 hours), after which the links are considered invalid and are not displayed (only a clickable link-name) when sent by a bot.

My need to update links to attachments.

I tried to use the discrod api and the "refresh-urls" method, but this requires a valid User Agent that stores the ?library? and its version. (https://discord.com/developers/docs/reference#http-api)

I won’t be able to download all the attachments either, because there isn’t a lot of space on the hosting where the bot is located.


Solution

  • As it turned out, attachments with the address "ephemeral-attachments" that are generated when using attachments in slash commands cannot be updated, it is necessary to use attachments with the address "attachments" and also remove the unnecessary parameters that come after the file type (ex, is, hm).