Image outside embed, only when image is a buffer.

Node.js 16.18.0 discord.js 14.6.0 After update discord.js from 13.9.2 to 14.6.0 images are not inside embed anymore. (no errors)
import { AttachmentBuilder, EmbedBuilder } from 'discord.js';

const stats = async (client, interaction) => {
const imageBuffer = await createChart(/*<chart data>*/);
const attachment = new AttachmentBuilder(imageBuffer, 'chart.jpg');
const embed = new EmbedBuilder()
.setImage('attachment://chart.jpg');

interaction.reply({
embeds: [embed],
files: [attachment]
});
};
import { AttachmentBuilder, EmbedBuilder } from 'discord.js';

const stats = async (client, interaction) => {
const imageBuffer = await createChart(/*<chart data>*/);
const attachment = new AttachmentBuilder(imageBuffer, 'chart.jpg');
const embed = new EmbedBuilder()
.setImage('attachment://chart.jpg');

interaction.reply({
embeds: [embed],
files: [attachment]
});
};
createChart creates image buffer, and i am sure image is correct, nothing changed here. Image buffer type is image/png When i replace image buffer to image path that already exists in data folder everything works as on d.js 13.9.2, image is inside embed.
const attachment = new AttachmentBuilder(imageBuffer, 'chart.jpg');
const attachment = new AttachmentBuilder(imageBuffer, 'chart.jpg');
to:
const attachment = new AttachmentBuilder(path.join(process.cwd(), 'data/chart.jpg'), 'chart.jpg');
const attachment = new AttachmentBuilder(path.join(process.cwd(), 'data/chart.jpg'), 'chart.jpg');
I know guide is a little outdated, but shows exactly the same code https://discordjs.guide/popular-topics/embeds.html#resending-and-editing What i am missing?
discord.js Guide
Imagine a guide... that explores the many possibilities for your discord.js bot.
2 Replies
Unknown User
Unknown User3y ago
Message Not Public
Sign In & Join Server To View
Michal__d
Michal__dOP3y ago
yes, that worked thank you i was looking for the issue somewhere else because this still works when i pass the string <a:aPES_Think:493353113332219924>
const attachment = new AttachmentBuilder(path.join(process.cwd(), 'data/chart.jpg'), 'chart.jpg');
const attachment = new AttachmentBuilder(path.join(process.cwd(), 'data/chart.jpg'), 'chart.jpg');
Want results from more Discord servers?
Add your server