Sending a message with an image attachment
I am trying to send a message with an image attachment as a command reply. This is the relevant code:
This used to work fine, but now I get this error:
I tried looking into that spot and it seems like the Discord API just directly returns the error about the empty message with an error code of 50006. The image I am appending is definitely valid - if I output it to my PC instead of attaching it, it shows no signs of corruption.
5 Replies
could you enable trace logging for more info? also what kord version are you using?
but if this suddenly stopped to work without any change in your code/kord version, i have an idea where it could come from
https://github.com/kordlib/kord/blob/0.9.x/rest/src/commonMain/kotlin/request/Request.kt#L88 - here we don't seem to properly match discord's docs: https://discord.com/developers/docs/reference#uploading-files
"file$index"
might have to be replaced with "file[$index]"
and "filename=$fileName"
with "filename=\"$fileName\""
GitHub
kord/Request.kt at 0.9.x · kordlib/kord
Idiomatic Kotlin Wrapper for The Discord API. Contribute to kordlib/kord development by creating an account on GitHub.
Discord Developer Portal
Discord Developer Portal — API Docs for Bots and Developers
Integrate your service with Discord — whether it's a bot or a game or whatever your wildest imagination can come up with.
so maybe some lenient internal thing at discord's site was made more strict so this now fails
however just speculations and thoughts at this point, need to try to repro and test my theory, but don't have time rn
hm, i can't reproduce this, the code i used:
does this code work for you @Marc?
Sorry for the late reply, but it does work. It seems like the issue was the size parameter in the
ChannelProvider
. If I just remove it, it works again. How weird... Thanks anyways.hm, alright
good to know that it works now :)