Reputation: 1
I'm trying to make my bot choose a random gif, and I can't understand why the gif doesn't load, the embed is sent as it should but the gif keeps loading infinitely
const list = require('./list.json');
module.exports = {
name: 'soco',
aliases: ['sc'],
utilisation: '{prefix}soco',
async execute(client, message, args) {
var user = message.mentions.members.first();
if(!user) return;
var randomColor = Math.floor(Math.random()*16777215).toString(16);
var colors = [
0xffffff,
0x000000,
0x0000ff,
0xff0000,
0x7a7a7a,
0x00ffff,
0xffd700,
0x4b0082
]
var randomgif = list[Math.floor(Math.random()* list.length)]
const embed = new MessageEmbed()
.setDescription(`${message.author} DEU UM SOCÃO EM ${user}`)
.setColor(colors[Math.floor(Math.random() * colors.length)])
.setImage(randomgif)
message.channel.send({ embeds: [embed]})
},
};
List.json
[
"https://tenor.com/view/anime-punch-knockout-wasted-smack-gif-11451829",
"https://tenor.com/view/punch-fight-anime-girl-rage-gif-15865733",
"https://tenor.com/view/slap-handa-seishuu-naru-kotoishi-barakamon-anime-barakamon-gif-5509136",
"https://tenor.com/view/anime-blush-shy-blushing-girl-gif-21835529",
"https://tenor.com/view/tgggg-anime-punch-gif-13142581",
"https://tenor.com/view/some-guy-getting-punch-anime-punching-some-guy-anime-anime-punch-punch-anime-gif-22671439",
"https://tenor.com/view/anime-smash-lesbian-punch-wall-gif-4790446",
"https://tenor.com/view/saki-saki-kanojo-mo-kanojo-kmk-saki-anime-gif-22206764",
"https://tenor.com/view/rin243109-blue-exorcist-anime-punch-gif-13785833",
"https://tenor.com/view/loli-shomin-sample-loliangry-kawai-gif-21035026",
"https://tenor.com/bf6G3.gif",
"https://tenor.com/bbJtm.gif"
]
PrintScreen [1]: https://i.sstatic.net/IU9QH.png
Upvotes: -1
Views: 4144
Reputation: 1362
That is because about all of the links are not gif
links. They're links directing to tenor.com website and will show you (yes the gif) but also the footer, the sign up button, other gifs that are related etc.. For each individual link (except the last two since they do end in .gif)
https://tenor.com/view/anime-punch-knockout-wasted-smack-gif-11451829
, replace it with https://tenor.com/Wdi5.gif
).gif
Upvotes: 1