You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Rename ImageData to DataUri and allow setting its mimetype (#3412)
Back in September 2024, Discord added [Soundboard][soundboard] APIs that allow
a bot to create a new sound by uploading raw mp3 or ogg data.
This data is specified as part of the JSON rather than a multipart upload (an
odd decision IMO); however, that means that the semantics of `ImageData` are
wrong as it makes too many assumptions about its contents. In particular, we
assume that the base64 data will always be an image, and the
`CreateAttachment::encode` method always assigns the `image/png` mimetype.
This commit removes these assumptions by renaming the struct to simply
`DataUri`, and now requiring the user to specify the mimetype when calling
`CreateAttachment::encode`.
[soundboard]: https://discord.com/developers/docs/resources/soundboard#soundboard-resource
0 commit comments