How can I put a canvas attachment into an embed?

My current code wont work, dont really know how to attach the file

            const attachment = new MessageAttachment(canvas.toBuffer());

            let embed = new MessageEmbed()
                .setTitle(`Hello`)
                .setDescription(Welcome!`)
                .setImage(attachment)
                .setColor(embedColor)

            message.channel.send({ embeds: [embed] })

1 answer

How many English words
do you know?
Test your English vocabulary size, and measure
how many words do you know
Online Test
Powered by Examplum