I'm making a Discord bot, and i don't want to use nekos.life anymore as an API for my fun commands. I'd like to make a list of gifs and have the bot choose a random one every time. this is what I have right now
const fetch = require('node-fetch');
const { MessageEmbed } = require('discord.js');
const { resolveMember } = require('../../Base/Functions')
module.exports = {
help: {
name: 'hug',
aliases: ['hug'],
description: 'Get a gif for Hugging someone :eyes:.',
category: __dirname.split("Commands\\")[1]
},
run: async (client, message, args) => {
let victim = message.mentions.users.first() || (args.length > 0 ? message.users.cache.filter(e => e.username.toLowerCase().includes(args.join(" ").toLowerCase())).first() : message.author) || message.author;
await fetch("https://api.miki.bot/images?tags=hug")
.then(res => res.json())
.then(body => {
const embed = new MessageEmbed()
.setColor(config.embedcolor)
.setTitle("Here's your Hug, ")
.setDescription(`${victim} is hugged by ${message.author}`)
.setImage(body.url)
.setTimestamp()
.setFooter(`© jolyne `, "https://static.wikia.nocookie.net/jjba/images/b/bb/Iggy_Normal_Anime.png/revision/latest?cb=20151108101034")
message.channel.send(embed);
});
},
};