#Attachment Images erroring

6 messages · Page 1 of 1 (latest)

upper cedar
#

Hi, I am currently using the AttachmentBuilder to attach a URL to a .edit({}) function

const file = new AttachmentBuilder(attachment);
await replyInteraction.edit({
      content: message,
      files: [file],
    });

The URL I am passing to (attachment) works perfectly fine in the browser, But it seems a lot of the time discord is showing it as a file instead of the image in the message and upon clicking the file it does not work and I get a This site can’t be reached might be temporarily down or it may have moved permanently to a new web address.. It works about 50% of the time fine.

Has anyone ever had this problem and if so I would love it if you could point me in the right direction.

Thanks for you time.

indigo hatchBOT
#

• What's your exact discord.js npm list discord.js and node node -v version?
• Post the full error stack trace, not just the top part!
• Show your code!
• Explain what exactly your issue is.
• Not a discord.js issue? Check out #useful-servers.

upper cedar
#

Discord: 14.9.0, Node: 20.0.0

#

I have also tried placing the url directly into the files: [url] and same result

granite pollen
#

When you pass an URL to that djs will try to download the file from that URL and then upload to discord again. There’s many reasons why that can fail (especially the downloading part). Is there a reason you need to send it as attachment instead of just sending a link to the original file?

upper cedar
#

mainly just if the original url goes away but ive changed it now to wait before it downloads. I think the url was not completed yet fully before discord were requesting it.