I'm trying to make this command on my discord bot where it sends a random kirby gif using the giphy api. However, I only want it to send one, but it sends multiple. This is the code:
client.on('message', message => {
if (message.content === 'k!gif')
giphy.search('gifs', {"q": "kirby"})
.then((response) => {
var totalResponses = response.data.length
var responseIndex = Math.floor((Math.random() * 10) + 1) % totalResponses;
var responseFinal = response.data[responseIndex]
message.channel.send("We stan kirby gifs", {
files: [responseFinal.images.fixed_height.url]
})
}).catch(() => {
message.channel.send('Kirby has run into a roadblock and was unable to complete his task.');
})
})
Thanks for helping in advance!