Move to /view
All checks were successful
NodBot Production Dockerization / build (pull_request) Successful in 9s

This commit is contained in:
Skylar Grant 2024-09-29 12:28:29 -04:00
parent e843275ba1
commit 0e34a0a4bb
6 changed files with 36 additions and 19 deletions

View File

@ -2,7 +2,6 @@ const customEmbeds = require('../CustomModules/Embeds.js');
const InteractionStorage = require('../CustomModules/InteractionStorage.js'); const InteractionStorage = require('../CustomModules/InteractionStorage.js');
const indexer = require('../CustomModules/Indexer.js'); const indexer = require('../CustomModules/Indexer.js');
const fn = require('../functions.js'); const fn = require('../functions.js');
const requests = require('../slash-commands/requests.js');
const { GifData } = require('./NodBot.js'); const { GifData } = require('./NodBot.js');
module.exports = { module.exports = {

View File

@ -50,14 +50,15 @@ module.exports = {
// Code Here... // Code Here...
const subcommand = interaction.options.getSubcommand(); const subcommand = interaction.options.getSubcommand();
const iStorage = interaction.client.iStorage.get(interaction.id); const iStorage = interaction.client.iStorage.get(interaction.id);
let commandData = { const commandData = {
author: interaction.user.username author: interaction.user.username,
} command: `/${interaction.commandName} ${subcommand}`
};
switch (subcommand) { switch (subcommand) {
// GIFs // GIFs
case "gifs": case "gifs":
if (!interaction.client.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; return;
} }
let indexedGifs = Indexer(interaction.client.gifs, 0); let indexedGifs = Indexer(interaction.client.gifs, 0);
@ -68,20 +69,15 @@ module.exports = {
for (const gif of indexedGifs.thisPage) { for (const gif of indexedGifs.thisPage) {
indexedGifs.gifsString += `[${gif.name}.gif](${gif.url})\n`; indexedGifs.gifsString += `[${gif.name}.gif](${gif.url})\n`;
} }
const commandData = { interaction.editReply(fn.embeds.gifs(commandData, indexedGifs));
command: "/gifs",
author: interaction.user.username
};
interaction.reply(fn.embeds.gifs(commandData, indexedGifs));
break; break;
// Joints // Joints
case "joints": case "joints":
if (!interaction.client.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; 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(); indexedJoints.jointsString = new String();
iStorage.page = 0; iStorage.page = 0;
@ -89,17 +85,39 @@ module.exports = {
for (const joint of indexedJoints.thisPage) { for (const joint of indexedJoints.thisPage) {
indexedJoints.jointsString += `${joint.content}\n`; indexedJoints.jointsString += `${joint.content}\n`;
} }
const commandData = { interaction.editReply(fn.embeds.joints(commandData, indexedJoints));
command: "/joints",
author: interaction.user.username
};
interaction.reply(fn.embeds.joints(commandData, indexedJoints));
break; break;
// Pastas // Pastas
case "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; break;
// Requests
case "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; break;
// Default // Default
default: default: