【问题标题】:Sending an image without the link showing with discord library发送不带不和谐库的链接的图像
【发布时间】:2018-09-12 07:48:35
【问题描述】:

我希望我的 discord 机器人发送图像(来自 url),但在聊天中发送的消息中隐藏 url。对于发送消息,我使用了一个 switch 语句,它只使用“!”之后的文字

            case 'happy':
            bot.sendMessage({
                to: channelID,
                message: 'https://pictureexample.jpg'
            });

如何在聊天中不显示链接的情况下发送消息?

【问题讨论】:

  • 如果你使用嵌入,你可以设置它的图像属性,它会显示没有 URL 的图像。

标签: javascript bots chatbot discord discord.io


【解决方案1】:

正如 user4261590 所写,您可以使用嵌入来实现这一点。这是一个可能适合您的示例:

case 'happy':
    const embed = {
        "image": {
            "url": "https://pictureexample.jpg"
        }
    };
    bot.sendMessage({
        to: channelID,
        message: embed
    });

【讨论】:

    猜你喜欢
    • 2021-08-03
    • 1970-01-01
    • 2021-10-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-02-28
    • 1970-01-01
    • 2014-11-07
    相关资源
    最近更新 更多