Sending an Embed with a Base64 Image

Is there a way to attach an image to an embed that's base64 encoded? Or does it have to be uploaded somewhere first? Thank you in advance 😄
4 Replies
d.js toolkit
d.js toolkit5mo 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! - Marked as resolved by OP
StephenS
StephenS5mo ago
djs 14.15.2 | node 22.1.0 | pnpm
d.js docs
d.js docs5mo ago
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]
});
:class: AttachmentBuilder @14.15.2 Represents an attachment builder
StephenS
StephenS5mo ago
Ahhhhh okay, perfect Going to test that right now You're a gem. Thank you @TAEMBO.md 🤝
Want results from more Discord servers?
Add your server