#Issue with sending an image file

1 messages · Page 1 of 1 (latest)

snow slate
#

Hi, I'm encountering an issue where I cannot send an image file without getting a "HTTPError [AbortError]: The user aborted a request." I read through this thread https://github.com/discordjs/discord.js/issues/3471, but increasing the retry limit didn't help. Does anyone have an idea of how I can fix this? Here is my code

GitHub

A powerful JavaScript library for interacting with the Discord API - Issues · discordjs/discord.js

#

msg.channel.send({files: ['./screenshots/img1.png']})
burnt nightBOT
#

MessageEmbed#attachFiles has been removed. Files should be attached via the message option object instead:

  const attachment = new MessageAttachment('./image.png', 'image1.png');
  const embed = new MessageEmbed()
-   .attachFiles([attachment])
    .setTitle('Attachments')
    .setImage(`attachment://${attachment.name}`);

- channel.send(embed)
+ channel.send({
+   embeds: [embed],
+   files: [attachment]
+ });
elder lynx
#

If you dont want the embed just omit it

#

But you need to create a MessageAttachment

snow slate
#

Will try that, thanks