gpt4 book ai didi

javascript - 图片未出现在 Discord.js Bot 的嵌入 URL 中

转载 作者:行者123 更新时间:2023-11-30 20:27:58 26 4
gpt4 key购买 nike

我现在遇到的问题是图像没有从我嵌入的 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)])
}

最佳答案

看起来您的图片 URL 来自 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,因为它已被弃用。否则,请注意您使用的是哪个库。

关于javascript - 图片未出现在 Discord.js Bot 的嵌入 URL 中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50675694/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com