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)])
}
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.
Related Questions
- → How to update data attribute on Ajax complete
- → October CMS - Radio Button Ajax Click Twice in a Row Causes Content to disappear
- → Octobercms Component Unique id (Twig & Javascript)
- → Passing a JS var from AJAX response to Twig
- → Laravel {!! Form::open() !!} doesn't work within AngularJS
- → DropzoneJS & Laravel - Output form validation errors
- → Import statement and Babel
- → Uncaught TypeError: Cannot read property '__SECRET_DOM_DO_NOT_USE_OR_YOU_WILL_BE_FIRED' of undefined
- → React-router: Passing props to children
- → ListView.DataSource looping data for React Native
- → Can't test submit handler in React component
- → React + Flux - How to avoid global variable
- → Webpack, React & Babel, not rendering DOM