Ad

Image Not Appearing From Embedded URL From Discord.js Bot

The problem that I am having right now is that the image is not showing up from the URL that I have embedded. Now usually for Discord, when you send an image link it appears like this: What usually happens when you send an image link

Now, I tried to embed the image links. This embedded the image URL fine, however, now the image did not pop out below the image URL but the embed works: The embedded image URL

Here is my current code:

} 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)])
}
Ad

Answer

It looks like your image URL is coming from memes[Math.floor(Math.random()*75)], is that correct?

You need to also set the URL on the image attribute of the embed. Like this:

const imageURL = memes[Math.floor(Math.random()*75)];

message.channel.sendMessage({embed: {
    color: 3447003,
    description: imageURL,
    image: {url: imageURL}
}});

Also, are you using the standard Discord.js library? If so, I'd recommend not using .sendMessage anymore because it is being deprecated. Otherwise, please note which library you're using.

Ad
source: stackoverflow.com
Ad