Sending Images with djs/rest
My issue is that the promise dont get resolved of the rest#post() neither the followup works in Discord and I dont see what the issue is.
My rest function:
getRest is a valid rest instance
My code that dont work
Image is a valid buffer generated with @napi-rs/canvas
Any ideas?
11 Replies
- What's your exact discord.js
npm list discord.js
and node node -v
version?
- Not a discord.js issue? Check out #other-js-ts.
- Consider reading #how-to-get-help to improve your question!
- Explain what exactly your issue is.
- Post the full error stack trace, not just the top part!
- Show your code!
- Issue solved? Press the button!
- ✅
Marked as resolved by OPThe reason is its a http only bot
I actually would like to stick to my own and only use /rest or are there any benifits of the core/http-only ?
(since its not a new bot its already a exisitng bot)
but about the form thing why does rest post have "files" as typing if I need to do it with formData? I expected that it does that by its own
thats what I tought too bcs of the "files" property
its a buffer
its a buffer generated from @napi-rs/canvas with
and generateImage returns
logged also the event 'response' from rest and it also dont get triggered
if you mean with auth token the bot token then yes
since when is both of these options needed I dont do that at the other 4 bots using the same function 💀
I dont get it
I see so would it be like this?
so wait can be removed? since I dont need the msg
ahhh
Okay I did that now, sadly it still at all dont work
I also dont get why it not just drop a error it just gets stuck
thats what I thought too but other cmds works fine
yes same route, but let me add that
no log
req.body
its 100% something wrong with the attachments but I just dont know what
(since when I comment files: out it response)
(thats files)
Just added that xD
everything other is still the same
sure
just logged the whole route to be sure and its what I expect
I just thought let me add .catch() and now I have a error
🤔
I would now add a console log at the resolveRequest but this minified dist is annoying
yeah would just do it for debugging tho
I cant really do much with the error since I defined name
yeah still same xd
its this pos of the code that currently errors isnt it? https://github.com/discordjs/discord.js/blob/main/packages/rest/src/lib/REST.ts#L359
GitHub
discord.js/packages/rest/src/lib/REST.ts at main · discordjs/discor...
A powerful JavaScript library for interacting with the Discord API - discordjs/discord.js
bcs if yes then I really dont know whats wrong <a:cry_cat:777955315291127829>
18.12.0
omg....
It works now
check here the version of rest I installed...
Yep had the same reaction
idk why but my npm likes to install old versions when I dont add @latest at the end
its from a old part of the bot I use collections from djs and was to lazy to require /collections xD
but still thanks for your help tho