Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing attachments for message/webhook edit #372

Closed
MrPowerGamerBR opened this issue Aug 24, 2021 · 6 comments · Fixed by #379
Closed

Missing attachments for message/webhook edit #372

MrPowerGamerBR opened this issue Aug 24, 2021 · 6 comments · Fixed by #379

Comments

@MrPowerGamerBR
Copy link
Contributor

The attachments field can be used to keep already existing attachments in a message, I guess that because Kord never uses that field, all attachments in the message are kept.

https://discord.com/developers/docs/resources/channel#edit-message
https://discord.com/developers/docs/resources/webhook#edit-webhook-message

@MrPowerGamerBR MrPowerGamerBR changed the title Missing attachments for messages Missing attachments for message/webhook edit Aug 24, 2021
@HopeBaron
Copy link
Member

Not all messages are the same. Ephemeral messages can't have files.

@MrPowerGamerBR
Copy link
Contributor Author

MrPowerGamerBR commented Aug 25, 2021

Not all messages are the same. Ephemeral messages can't have files.

Yes... but I'm not talking about file upload, I'm talking about removing files from an existing message

From the docs

attachments array of attachment objects attached files to keep

Unless if I'm blind, Kord doesn't seem to support this (it isn't present in the persistent message modify builder), you can attach new files to a message, sure, but you can't remove attachments from an existing message.

I may be misunderstanding what the attachments field does, but it would still be missing from Kord anyways.

@HopeBaron
Copy link
Member

HopeBaron commented Aug 25, 2021

attachments are files on your side.
Discord attaches meta data to these files and call them attachements

files field

@MrPowerGamerBR
Copy link
Contributor Author

MrPowerGamerBR commented Aug 25, 2021

attachments are files on your side.
Discord attaches meta data to these files and call them attachements

files field

The files field is used for file upload, sure, this makes sense and it does work.

But if you are editing a message (via webhooks, normal messages or interactions) you can also remove files already uploaded to it, so, what I can do is: Send a message with a "image.png" file and then later edit the message by uploading a "image.gif" file to it, and using the attachments field to remove the original "image.png" file.

Currently with Kord, while you can add new files to an already existing message, you can't remove the original image from the message.

Of course, I may be misunderstanding what the Discord documentation says, but "attached files to keep" seems to be that it can be used to remove files from an existing message, and the attachments field doesn't exist on the create message endpoint, which further makes me think that this can be used to remove attachments from a message.

@HopeBaron
Copy link
Member

just provide an empty list for the files and it will remove the files.
null acts as no-op in our modify builders.

@MrPowerGamerBR
Copy link
Contributor Author

just provide an empty list for the files and it will remove the files.
null acts as no-op in our modify builders.

That's what I did, and it didn't work 😭

Probably because setting an empty list just clears the file field (so it removes any file that was going to be uploaded), it doesn't change anything in the attachments field because Kord doesn't use it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants