Skip to content

edit-message: expose attachments array#19

Open
ja-cop wants to merge 1 commit intosimmsb:masterfrom
ja-cop:edit_message_attachments
Open

edit-message: expose attachments array#19
ja-cop wants to merge 1 commit intosimmsb:masterfrom
ja-cop:edit_message_attachments

Conversation

@ja-cop
Copy link
Contributor

@ja-cop ja-cop commented Jan 29, 2025

From the documentation:

To remove or replace files you will have to supply the attachments field which specifies the files to retain on the message after edit.

In particular, this allows editing a message with an embed that referenced a file uploaded in the same message, without the file now showing up outside the embed. This issue had been previously reported here, and the workaround from one of the responses, translated to racket-cord:

(http:edit-message myclient channel-id message-id #:embed updated-embed #:attachments null)

I think it's related to this oddity.

The way the Discord API handles attachments is not great IMO, but since racket-cord is pretty low level, I guess we should just expose it the way it is?

@ja-cop
Copy link
Contributor Author

ja-cop commented Jan 30, 2025

For future reference, the workaround to the problem I described when editing an embed message, is not to remove the attachment, but to use the same attachment://filename style reference in the edited embed as was used when creating the message with the attachment in the first place.

Removing the attachment can invalidate the attachment's CDN URL - it's probably deleted on Discord's backend - if the message being edited is the only reference to the attachment.

As for this PR, some people may still find it useful to be able to remove or edit attachments from messages, but I don't have a use case for it right now 🙂

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 this pull request may close these issues.

1 participant