#Can't send attachment from buffer
39 messages · Page 1 of 1 (latest)
- What's your exact discord.js
npm list discord.jsand nodenode -vversion? - Not a discord.js issue? Check out #1081585952654360687.
- 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!
well
i cant send the code
ig
i will send the whole bot
(theres nothing much)
wait
i get this error from error.rawError.errors.attachments["0"].id._errors
it said i need to put id
which this is buffer bruh
i dont know whats going on
please do not mention my skill issue on Object.values(GatewayIntentBits)
But I can already figure you probably didn’t pass the file you want to send in files: [..] array?
Yup, line 48 needs to be files:, not attachments:
i need to pass buffer to files array first?
but it also contain attachment from user
should i keep that attachment on attachments and move buffer to files?
Yes? But you send a new message with a new attachment. attachments: is only for edit when you want to keep prior attachments
Both are new attachments to that message because that message didn’t exist before. All you literally have to change is line 48 should have the word files: instead of attachments:
so not much changes needed
No
what syntax do i use for files:?
i changed to files and got 1 to work, but the thumbnail doesnt come up("thumbnail" from files:)
When I say literally I literally mean literally. I never use literally figuratively.
Why do you convert all your buffers so often there? First with the fetch having at least 2 unnecessary conversions and then in the AttachmentBuilder you convert the buffer you already have into an array and then a buffer again 
;-;
Probably somewhere in that process you turn your correct file into a corrupt one
fetch have only .arrayBuffer(), which i convert it into buffer, and in attachmentbuilder, .toBuffer() somehow return arrayBuffer instead
stl did render without error, so i guess the fetch's conversion is fine