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] 
  });
};

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');
to:
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?
Imagine a guide... that explores the many possibilities for your discord.js bot.
Was this page helpful?