I am trying to get my bot to send and embed and I want the gif to change each time, but for some reason when I put the array variable inside the .setImage() it doesn't work. The message is sent, but its just missing a picture. Here is my code.
var string1 = message.content.substring(6);
let channel = message.channel;
var Gifs = ['https://media.giphy.com/media/yUzMZZWrU6aZy/giphy.gif', "https://th.bing.com/th/id/R.e2cf7c01031a331ccef83051a973ea9e?rik=9NSxT6EyIBiNfw&riu=http%3a%2f%2fgifimage.net%2fwp-content%2fuploads%2f2017%2f07%2fanime-slap-gif-13.gif&ehk=Z1bcjra0ue2IWQAqeic6ZrIkMFS6Hxcvk%2boKlN5TPF4%3d&risl=&pid=ImgRaw&r=0", "https://media1.tenor.com/images/f619012e2ec268d73ecfb89af5a8fb51/tenor.gif?itemid=8562186", "https://media.giphy.com/media/L7iHfUrBk3cqY/giphy.gif", "https://gifimage.net/wp-content/uploads/2017/07/anime-slap-gif-12.gif"];
var anim = Math.floor(Math.random() * 5);
var anims = anim[Gifs];
const exampleEmbed = new Discord.MessageEmbed()
.setColor('#04785f')
.setTitle('Instant Replay:')
.setImage(anims)
.setTimestamp()
console.log(string1)
message.channel.send('You slapped: ' + string1);
channel.send(exampleEmbed);
var string1 = message.content.substring(6);
let channel = message.channel;
var Gifs = [
'https://media.giphy.com/media/yUzMZZWrU6aZy/giphy.gif',
"https://th.bing.com/th/id/R.e2cf7c01031a331ccef83051a973ea9e?rik=9NSxT6EyIBiNfw&riu=http%3a%2f%2fgifimage.net%2fwp-content%2fuploads%2f2017%2f07%2fanime-slap-gif-13.gif&ehk=Z1bcjra0ue2IWQAqeic6ZrIkMFS6Hxcvk%2boKlN5TPF4%3d&risl=&pid=ImgRaw&r=0",
//"https://media1.tenor.com/images/f619012e2ec268d73ecfb89af5a8fb51/tenor.gif?itemid=8562186",
// invalid link
"https://media.giphy.com/media/L7iHfUrBk3cqY/giphy.gif",
// "https://gifimage.net/wp-content/uploads/2017/07/anime-slap-gif-12.gif"
// invalid link
];
const anim = Gifs[Math.floor(Math.random() * Gifs.length)];
const exampleEmbed = new Discord.MessageEmbed()
.setColor('#04785f')
.setTitle('Instant Replay:')
.setImage(anim)
.setTimestamp()
console.log(string1)
// if using discord v12
channel.send(`You slapped: ${string1}`);
channel.send(exampleEmbed);
// if using discord v13
channel.send({
content: `You slapped: ${string1}`,
embeds: [exampleEmbed]
})