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
feat(MessageAttachment): description (alt text) support #6871
Conversation
Just realized I never testing sending so after quickly checking, I've found the description does not get sent. Will convert to a draft and work on fixing that! |
…llow for alt text
Co-authored-by: D Trombett <maxtromb.dt@gmail.com>
src/rest/APIRequest.js
Outdated
for (const file of this.options.files) { | ||
if (file?.file) body.append(file.key ?? file.name, file.file, file.name); | ||
for (const [index, file] of this.options.files.entries()) { | ||
if (file?.file) body.append(`files[${index}]`, file.file, file.name); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Won't this break emoji create?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Emoji creates seem to work fine but I went to test stickers and can't get sticker creation working even after reverting this.
Would appreciate if someone else who knows how that's meant to work could give it a try to make sure I didn't break it and am just being dumb
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wrote sticker uploading and it uses file.key
; can you just set the key
to files[${index}]
in the relevant message posting code instead of modifying this? (you can also remove ?? file.name
after doing that if you want)
(emoji create uses a data uri in json)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After taking a look around, it seems adding file.key ??
should work but I'm still unable to get sticker creation working with or without my changes.
@advaith1 could you try with my latest changes and check to make sure sticker creation still works? I've checked sending a message with attachments and that works fine so all that's left to check (to my knowledge) is sticker creation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Has this been resolved?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd still prefer that the `files[${index}]`
logic is moved to the message code (which would just set that as file.key, for consistency) instead of the request code, but that isn't really necessary
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you also document and type description
for FileOptions
? 🙏
It seems to be working right out of the box already.
There is no PR documenting that in discord/discord-api-docs, or did I just not find it?
Added description to the examples and added It was added in discord/discord-api-docs#3860 |
Ported from discordjs/discord.js#6871 Co-authored-by: Jake Ward <geek@gaminggeek.dev>
Please describe the changes this PR makes and why it should be merged:
This adds the description property to the MessageAttachment class which is used for alt text added in the client (just added in the latest build but behind an experiment)
Status and versioning classification: