How to import images in a embed message?

how to import images that are in my bot folder in a embed message? Node -v 18.16.0 discord.js 14.11.0
5 Replies
d.js toolkit
d.js toolkit11mo ago
- What's your exact discord.js npm list discord.js and node node -v version? - Not a discord.js issue? Check out #other-js-ts. - 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!
Massicraft
Massicraft11mo ago
and video/giphs?
d.js docs
d.js docs11mo ago
Tag suggestion for @massicraft: Files in embeds should be attached via the message option object and referenced in the embed:
const attachment = new AttachmentBuilder('./image.png', { name: 'image1.png' });
const embed = new EmbedBuilder()
.setTitle('Attachments')
.setImage(`attachment://${attachment.name}`);

channel.send({
embeds: [embed],
files: [attachment]
});
const attachment = new AttachmentBuilder('./image.png', { name: 'image1.png' });
const embed = new EmbedBuilder()
.setTitle('Attachments')
.setImage(`attachment://${attachment.name}`);

channel.send({
embeds: [embed],
files: [attachment]
});
Squid
Squid11mo ago
Paths to png, jpg, webp, gif work Bots cannot embed video formats like mp4
Massicraft
Massicraft11mo ago
thank you @Squid