nodbot/slash-commands/gifs.js.bak
Skylar Grant 0e34a0a4bb
All checks were successful
NodBot Production Dockerization / build (pull_request) Successful in 9s
Move to /view
2024-09-29 12:28:29 -04:00

30 lines
961 B
JavaScript

const { SlashCommandBuilder } = require('@discordjs/builders');
const { config } = require('dotenv');
const fn = require('../functions.js');
const indexer = require('../CustomModules/Indexer.js');
module.exports = {
data: new SlashCommandBuilder()
.setName('gifs')
.setDescription('Get a list of currently saved GIFs.'),
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;
}
let iStorage = interaction.client.iStorage.get(interaction.id);
let indexedGifs = indexer(interaction.client.gifs, 0);
indexedGifs.gifsString = new String();
iStorage.page = 0;
for (const gif of indexedGifs.thisPage) {
indexedGifs.gifsString += `[${gif.name}.gif](${gif.url})\n`;
}
const commandData = {
command: "/gifs",
author: interaction.user.username
};
interaction.reply(fn.embeds.gifs(commandData, indexedGifs));
}
};