如何将图像附加到Discord js v12嵌入?

时间:2020-07-29 00:15:02

标签: node.js

每当我尝试将图像附加到嵌入时,它都不会出现!


    var captchaURL = new Discord.MessageAttachment(`./userCaptchas/${c.value}.bmp`, 'captchaurl.bmp');
    

    const cap = new Discord.MessageAttachment(captchaURL);
    const embed = new Discord.MessageEmbed()
    .setTitle('Please Complete the captcha!')
    .attachFiles(captchaURL)
    .setImage('attachment://captchaurl.bmp')
    user.send(embed);

1 个答案:

答案 0 :(得分:0)

您只能将图片网址设置为setImage()的参数 解决问题的最简单方法是将图像发送到不协调的渠道,复制图像的链接,然后将该链接用作.setImage()方法的参数。

考虑一下以下内容:https://discordjs.guide/popular-topics/embeds.html#embed-preview