#Can't send attachment from buffer

39 messages · Page 1 of 1 (latest)

fast terrace
#

i made a bot that preview STL files, but got an error when trying to send the message, Code and error is below

carmine pendantBOT
#
  • What's your exact discord.js npm list discord.js and node node -v version?
  • 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!
fast terrace
#

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)

waxen spokeBOT
#

To share long code snippets use a service like gist, sourcebin, starbin, or similar instead of posting them as large code blocks.

fast terrace
#

a

#

ok this time not codeboard

spiral trench
#

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:

fast terrace
fast terrace
#

should i keep that attachment on attachments and move buffer to files?

spiral trench
#

Yes? But you send a new message with a new attachment. attachments: is only for edit when you want to keep prior attachments

fast terrace
#

so i should convert both to files, but how?

#

(i always use attachments)

spiral trench
#

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:

fast terrace
#

so not much changes needed

spiral trench
#

No

fast terrace
#

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:)

spiral trench
fast terrace
#

(the name is generated by tinkercad, not me)

spiral trench
# fast terrace https://sourceb.in/jaMNzZEA5K

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 waitWhat

fast terrace
#

;-;

spiral trench
#

Probably somewhere in that process you turn your correct file into a corrupt one

fast terrace
#

stl did render without error, so i guess the fetch's conversion is fine