【问题标题】:Image not appearing from embedded URL from Discord.js Bot图像未从 Discord.js Bot 的嵌入式 URL 中显示
【发布时间】:2018-11-13 12:00:47
【问题描述】:

我现在遇到的问题是图像没有从我嵌入的 URL 中显示出来。现在通常对于 Discord,当您发送图像链接时,它会显示如下: What usually happens when you send an image link

现在,我尝试嵌入图片链接。这很好地嵌入了图像 URL,但是,现在图像没有在图像 URL 下方弹出,但嵌入工作:The embedded image URL

这是我当前的代码:

} else if(message.content == '/memes' || message.content =='/meme') {
    message.channel.sendMessage({embed: {
        color: 3447003,
        description: memes[Math.floor(Math.random()*75)]
      }});
      //message.reply(memes[Math.floor(Math.random()*75)])
}

【问题讨论】:

    标签: javascript hyperlink embed discord discord.js


    【解决方案1】:

    您的图片网址似乎来自memes[Math.floor(Math.random()*75)],对吗?

    您还需要在嵌入的 image 属性上设置 URL。像这样:

    const imageURL = memes[Math.floor(Math.random()*75)];
    
    message.channel.sendMessage({embed: {
        color: 3447003,
        description: imageURL,
        image: {url: imageURL}
    }});
    

    另外,您使用的是标准 Discord.js 库吗?如果是这样,我建议不要再使用.sendMessage,因为它已被弃用。否则,请注意您使用的是哪个库。

    【讨论】:

      猜你喜欢
      • 2018-07-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-11-01
      • 2020-12-06
      • 2016-12-22
      • 2013-06-24
      • 1970-01-01
      相关资源
      最近更新 更多