send base64 string on Embed

I have an image in a base64 string. how to send this image when embedding in EmbedBuilder? like:
const myBase64 = ...

const embed = new EmbedBuilder()
.setImage(myBase64)

interaction.reply({ embeds: [embed] })
const myBase64 = ...

const embed = new EmbedBuilder()
.setImage(myBase64)

interaction.reply({ embeds: [embed] })
node -v v18.15.0
8 Replies
d.js toolkit
d.js toolkit11mo ago
• 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.
Unknown User
Unknown User11mo ago
Message Not Public
Sign In & Join Server To View
d.js docs
d.js docs11mo 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]
});
Unknown User
Unknown User11mo ago
Message Not Public
Sign In & Join Server To View
</Nexus_Prime>
</Nexus_Prime>11mo ago
image is not showing @.gwapes
const imageBuffer = Buffer.from(imagemQrcode)

const embed = new EmbedBuilder()
.setImage('attachment://qrcode')
.setDescription(`chave: \`${qrcode}\``);

const attachment = new AttachmentBuilder(imageBuffer, { name: 'qrcode' })

interaction.editReply({ embeds: [embed], files: [attachment] })
const imageBuffer = Buffer.from(imagemQrcode)

const embed = new EmbedBuilder()
.setImage('attachment://qrcode')
.setDescription(`chave: \`${qrcode}\``);

const attachment = new AttachmentBuilder(imageBuffer, { name: 'qrcode' })

interaction.editReply({ embeds: [embed], files: [attachment] })
Unknown User
Unknown User11mo ago
Message Not Public
Sign In & Join Server To View
d.js docs
d.js docs11mo ago
node Static method: Buffer.from(array) Allocates a new Buffer using an array of bytes in the range 0255. Array entries outside that range will be truncated to fit into it.
Unknown User
Unknown User11mo ago
Message Not Public
Sign In & Join Server To View