最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Sending an image without the link showing with discord library - Stack Overflow

programmeradmin1浏览0评论

I would like my discord bot to send an image (from a url), but have the url be hidden from the message that is sent in chat. For sending messages, im using a switch statement that only uses the writing after an "!"

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

How would I send messages without having the link show in chat?

I would like my discord bot to send an image (from a url), but have the url be hidden from the message that is sent in chat. For sending messages, im using a switch statement that only uses the writing after an "!"

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

How would I send messages without having the link show in chat?

Share Improve this question asked Apr 3, 2018 at 4:40 Julian LJulian L 841 gold badge3 silver badges11 bronze badges 1
  • If you use an embed you can set its image property and it will show the image without the URL. – user4261590 Commented Apr 6, 2018 at 20:49
Add a ment  | 

1 Answer 1

Reset to default 2

As user4261590 wrote, you can use embeds to achieve this. Here's an example that might work for you:

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

评论列表(0)

  1. 暂无评论