diff --git a/CustomModules/ButtonHandlers.js b/CustomModules/ButtonHandlers.js index 81aa980..f059370 100644 --- a/CustomModules/ButtonHandlers.js +++ b/CustomModules/ButtonHandlers.js @@ -2,7 +2,6 @@ const customEmbeds = require('../CustomModules/Embeds.js'); const InteractionStorage = require('../CustomModules/InteractionStorage.js'); const indexer = require('../CustomModules/Indexer.js'); const fn = require('../functions.js'); -const requests = require('../slash-commands/requests.js'); const { GifData } = require('./NodBot.js'); module.exports = { diff --git a/slash-commands/gifs.js b/slash-commands/gifs.js.bak similarity index 100% rename from slash-commands/gifs.js rename to slash-commands/gifs.js.bak diff --git a/slash-commands/joints.js b/slash-commands/joints.js.bak similarity index 100% rename from slash-commands/joints.js rename to slash-commands/joints.js.bak diff --git a/slash-commands/pastas.js b/slash-commands/pastas.js.bak similarity index 100% rename from slash-commands/pastas.js rename to slash-commands/pastas.js.bak diff --git a/slash-commands/requests.js b/slash-commands/requests.js.bak similarity index 100% rename from slash-commands/requests.js rename to slash-commands/requests.js.bak diff --git a/slash-commands/view.js b/slash-commands/view.js index f31c2b4..798394d 100644 --- a/slash-commands/view.js +++ b/slash-commands/view.js @@ -50,14 +50,15 @@ module.exports = { // Code Here... const subcommand = interaction.options.getSubcommand(); const iStorage = interaction.client.iStorage.get(interaction.id); - let commandData = { - author: interaction.user.username - } + const commandData = { + author: interaction.user.username, + command: `/${interaction.commandName} ${subcommand}` + }; switch (subcommand) { // GIFs case "gifs": if (!interaction.client.gifs) { - interaction.reply('For some reason I don\'t have access to the collection of gifs. Sorry about that!'); + interaction.editReply('For some reason I don\'t have access to the collection of gifs. Sorry about that!'); return; } let indexedGifs = Indexer(interaction.client.gifs, 0); @@ -68,20 +69,15 @@ module.exports = { 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)); + interaction.editReply(fn.embeds.gifs(commandData, indexedGifs)); break; // Joints case "joints": if (!interaction.client.joints) { - interaction.reply('For some reason I don\'t have access to the collection of joints. Sorry about that!'); + interaction.editReply('For some reason I don\'t have access to the collection of joints. Sorry about that!'); return; } - let iStorage = interaction.client.iStorage.get(interaction.id); - let indexedJoints = indexer(interaction.client.joints, 0); + let indexedJoints = Indexer(interaction.client.joints, 0); indexedJoints.jointsString = new String(); iStorage.page = 0; @@ -89,17 +85,39 @@ module.exports = { for (const joint of indexedJoints.thisPage) { indexedJoints.jointsString += `${joint.content}\n`; } - const commandData = { - command: "/joints", - author: interaction.user.username - }; - interaction.reply(fn.embeds.joints(commandData, indexedJoints)); + interaction.editReply(fn.embeds.joints(commandData, indexedJoints)); break; // Pastas case "pastas": + if (!interaction.client.pastas) { + interaction.editReply({ content: 'For some reason I don\'t have access to the collection of copypastas. Sorry about that!', ephemeral: true }); + return; + } + let indexedPastas = Indexer(interaction.client.pastas, 0); + indexedPastas.pastasString = new String(); + + iStorage.page = 0; + + for (const pasta of indexedPastas.thisPage) { + indexedPastas.pastasString += `${pasta.name}.pasta\n`; + } + interaction.editReply(fn.embeds.pastas(commandData, indexedPastas)); break; -// Requests case "requests": + if (!interaction.client.requests) { + interaction.editReply('For some reason I don\'t have access to the collection of requests. Sorry about that!'); + return; + } + let indexedRequests = Indexer(interaction.client.requests, 0); + indexedRequests.requestsString = new String(); + + iStorage.page = 0; + + for (const request of indexedRequests.thisPage) { + indexedRequests.requestsString += `[${request.id}]: ${request.request} (submitted by ${request.author})\n`; + } + + interaction.editReply(fn.embeds.requests(commandData, indexedRequests)); break; // Default default: