【问题标题】:How can I put a canvas attachment into an embed?如何将画布附件放入嵌入中?
【发布时间】:2021-09-11 17:56:34
【问题描述】:

我当前的代码不起作用,真的不知道如何附加文件

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

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

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

【问题讨论】:

  • 投票结束,因为问题缺少细节并且没有说明问题所在。
  • 我不知道如何将画布文件(画布图片)附加到嵌入中,如果我提供的内容不清楚,我很抱歉

标签: discord.js canvasjs


【解决方案1】:

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

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

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2013-12-07
    • 1970-01-01
    • 2021-06-15
    • 2011-03-10
    • 1970-01-01
    • 2011-04-03
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多