如何将 canvas 附件放入嵌入中?

How can I put a canvas attachment into an embed?

我当前的代码无法运行,不知道如何附加文件

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

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

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

从移植指南到 v13,因为您列出了更新的嵌入语法,这意味着这是您的版本...

channel.send({ embeds: [embed], files: ['./image1.png', './image2.jpg'] });

https://discordjs.guide/additional-info/changes-in-v13.html#sending-messages-embeds-files-etc