我希望我的discord bot能够发送图像(来自网址),但是在聊天中发送的消息中隐藏了网址。对于发送消息,我使用的switch语句仅在“!”之后使用写入
case 'happy':
bot.sendMessage({
to: channelID,
message: 'https://pictureexample.jpg'
});
如果没有在聊天中显示链接,我将如何发送消息?
答案 0 :(得分:1)
正如user4261590所写,您可以使用嵌入来实现此目的。这是一个可能适合您的示例:
case 'happy':
const embed = {
"image": {
"url": "https://pictureexample.jpg"
}
};
bot.sendMessage({
to: channelID,
message: embed
});