我希望我的Discord bot发送图像(从URL(,但请从聊天中发送的消息中隐藏URL。对于发送消息,我使用仅在"!"之后使用写作的开关语句。
case 'happy':
bot.sendMessage({
to: channelID,
message: 'https://pictureexample.jpg'
});
我将如何在聊天中链接显示的情况下发送消息?
作为用户4261590写的,您可以使用嵌入来实现这一目标。这是一个可能对您有用的示例:
case 'happy':
const embed = {
"image": {
"url": "https://pictureexample.jpg"
}
};
bot.sendMessage({
to: channelID,
message: embed
});