const { SlashCommandBuilder } = require('@discordjs/builders'); const help = require('../helpFunctions.js'); require('dotenv').config(); module.exports = { data: new SlashCommandBuilder() .setName('headpat') .setDescription('Headpat someone!') .addMentionableOption(options => options.setName('who') .setDescription('Is for me? c:')), async execute(interaction) { const resultTuple = await headpat(interaction); const embed = resultTuple[1]; if (resultTuple[0] == null) { interaction.reply({ embeds: [embed] }); } else { const msgContent = resultTuple[0]; interaction.reply({ content: msgContent, embeds: [embed] }); } }, }; async function headpat(interaction) { const searchKey = 'headpat-anime'; const gifAmount = 16; const gifs = `https://g.tenor.com/v1/search?q=${searchKey}&key=${process.env.TENOR}&limit=${gifAmount}`; return help.getGifWithMessage(interaction, gifs, gifAmount); }