2021-09-22 17:15:31 +00:00
|
|
|
const { SlashCommandBuilder } = require('@discordjs/builders');
|
|
|
|
const { config } = require('dotenv');
|
|
|
|
const fn = require('../functions.js');
|
|
|
|
|
|
|
|
module.exports = {
|
|
|
|
data: new SlashCommandBuilder()
|
|
|
|
.setName('gifs')
|
|
|
|
.setDescription('Get a list of currently saved GIFs.'),
|
|
|
|
async execute(interaction) {
|
|
|
|
if (!interaction.client.gifs) {
|
|
|
|
interaction.reply('For some reason I don\'t have access to the collection of gifs. Sorry about that!');
|
|
|
|
return;
|
|
|
|
}
|
2023-08-08 17:25:07 +00:00
|
|
|
// const gifsMap = interaction.client.gifs.map(e => {e.name, e.url});
|
|
|
|
// const commandData = {
|
|
|
|
// gifs: [],
|
|
|
|
// command: 'gifs',
|
|
|
|
// author: interaction.user.tag,
|
|
|
|
// };
|
|
|
|
// for (const row of gifsMap) {
|
|
|
|
// commandData.gifs.push({
|
|
|
|
// id: row.id,
|
|
|
|
// name: row.name,
|
|
|
|
// });
|
|
|
|
// }
|
|
|
|
let gifList = [];
|
|
|
|
interaction.client.gifs.forEach(element => {
|
|
|
|
gifList.push(`[${element.name}](${element.url})`);
|
2021-09-22 17:15:31 +00:00
|
|
|
});
|
|
|
|
const commandData = {
|
2023-08-08 17:25:07 +00:00
|
|
|
command: "/gifs",
|
|
|
|
author: interaction.member.displayName
|
2021-09-22 17:15:31 +00:00
|
|
|
};
|
2023-08-08 17:25:07 +00:00
|
|
|
interaction.reply(fn.embeds.gifs(commandData, gifList));
|
2021-09-22 17:15:31 +00:00
|
|
|
},
|
|
|
|
};
|