#How to make an attachment from an http response

10 messages · Page 1 of 1 (latest)

velvet roost
#

I'm making an http request with await fetch(imageUrl) and would like to turn that into an Attachment for use in an embed thumbnail. What is the most efficient way to do that? I'm kinda struggling with streams and buffers.

finite karmaBOT
#
  • 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!
  • Marked as resolved by OP
velvet roost
crimson vortex
#

Dont even need to fetch it

#

The AttachmentBuilder accepts URLs

velvet roost
#

I can't just put the image url into the embed because the service blocks the discord crawler. I need my bot to download and rebupload it

#

oh

crimson vortex
#

oh

#

Hmm, might still work via attachment though

velvet roost
#

I didn't notice that strings are BufferResolvables, I'll try that