Attaching local file in embed.

So i'm using this code.

const handlers = require("../handlerLoader.js");
const { EmbedBuilder, MessageAttachment } = require("discord.js");
module.exports = {
    name: "agree",

    async execute(interaction) {
        const captcha = handlers.captchaHandler.generateCaptcha();
        const captchaEmbed = new EmbedBuilder()
            .setColor(0x2B2D31)
            .setAuthor({
                name: "Captcha Code",
            })
            .setImage(captcha.filePath)

            await interaction.reply({
                embeds: [captchaEmbed],
                ephemeral: true,
            });
    },
};


The variable captcha.filePath like its name hold the file path to a png image.
When the button is clicked this error is passed.

Could someone advice me on what i'm doing wrong, Does the .setImage only take URL/URIs?
Error.txt4.64KB
Was this page helpful?