Compare commits
No commits in common. "0e34a0a4bb4f20db956f993f4d98bfed6faba9a5" and "28bd2f46cb63b2840e415a93abadb181d93b5379" have entirely different histories.
0e34a0a4bb
...
28bd2f46cb
@ -2,6 +2,7 @@ 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 = {
|
||||
@ -80,7 +81,7 @@ module.exports = {
|
||||
indexedGifs.gifsString += `[${gif.name}.gif](${gif.url})\n`;
|
||||
}
|
||||
|
||||
interaction.update(fn.embeds.gifs({command: "/gifs", author: interaction.user.username}, indexedGifs));
|
||||
interaction.update(fn.embeds.gifs({command: "/gifs", author: interaction.member.displayName}, indexedGifs));
|
||||
},
|
||||
pastasPage(interaction) {
|
||||
const iStorage = interaction.client.iStorage.get(interaction.message.interaction.id);
|
||||
@ -106,7 +107,7 @@ module.exports = {
|
||||
indexedPastas.pastasString += `${pasta.name}.pasta\n`;
|
||||
}
|
||||
|
||||
interaction.update(fn.embeds.pastas({command: "/pastas", author: interaction.user.username}, indexedPastas));
|
||||
interaction.update(fn.embeds.pastas({command: "/pastas", author: interaction.member.displayName}, indexedPastas));
|
||||
},
|
||||
requestsPage(interaction) {
|
||||
const iStorage = interaction.client.iStorage.get(interaction.message.interaction.id);
|
||||
@ -132,7 +133,7 @@ module.exports = {
|
||||
indexedRequests.requestsString += `[${request.id}]: ${request.request} (submitted by ${request.author})\n`;
|
||||
}
|
||||
|
||||
interaction.update(fn.embeds.requests({command: "/requests", author: interaction.user.username}, indexedRequests));
|
||||
interaction.update(fn.embeds.requests({command: "/requests", author: interaction.member.displayName}, indexedRequests));
|
||||
},
|
||||
jointsPage(interaction) {
|
||||
const iStorage = interaction.client.iStorage.get(interaction.message.interaction.id);
|
||||
@ -158,7 +159,7 @@ module.exports = {
|
||||
indexedJoints.jointsString += `${joint.content}\n`;
|
||||
}
|
||||
|
||||
interaction.update(fn.embeds.joints({command: "/joints", author: interaction.user.username}, indexedJoints));
|
||||
interaction.update(fn.embeds.joints({command: "/joints", author: interaction.member.displayName}, indexedJoints));
|
||||
},
|
||||
gifSearchPage(interaction) {
|
||||
const iStorage = interaction.client.iStorage.get(interaction.message.interaction.id);
|
||||
@ -196,7 +197,7 @@ module.exports = {
|
||||
indexedGifs.query = iStorage.query;
|
||||
indexedGifs.gifName = iStorage.gifName;
|
||||
// Generate the embed
|
||||
const gifEmbed = customEmbeds.core.gifSearch({ author: interaction.user.username }, indexedGifs);
|
||||
const gifEmbed = customEmbeds.core.gifSearch({ author: interaction.member.displayName }, indexedGifs);
|
||||
// Update the interaction
|
||||
interaction.update({ embeds: [gifEmbed], components: [gifSearchAR], ephemeral: true });
|
||||
}
|
||||
|
@ -23,7 +23,7 @@ module.exports = {
|
||||
}
|
||||
const commandData = {
|
||||
command: "/gifs",
|
||||
author: interaction.user.username
|
||||
author: interaction.member.displayName
|
||||
};
|
||||
interaction.reply(fn.embeds.gifs(commandData, indexedGifs));
|
||||
}
|
@ -22,7 +22,7 @@ module.exports = {
|
||||
}
|
||||
const commandData = {
|
||||
command: "/joints",
|
||||
author: interaction.user.username
|
||||
author: interaction.member.displayName
|
||||
};
|
||||
interaction.reply(fn.embeds.joints(commandData, indexedJoints));
|
||||
},
|
@ -23,7 +23,7 @@ module.exports = {
|
||||
}
|
||||
const commandData = {
|
||||
command: "/pastas",
|
||||
author: interaction.user.username
|
||||
author: interaction.member.displayName
|
||||
};
|
||||
interaction.reply(fn.embeds.pastas(commandData, indexedPastas));
|
||||
},
|
@ -24,7 +24,7 @@ module.exports = {
|
||||
|
||||
const commandData = {
|
||||
command: "/requests",
|
||||
author: interaction.user.username
|
||||
author: interaction.member.displayName
|
||||
};
|
||||
interaction.reply(fn.embeds.requests(commandData, indexedRequests));
|
||||
},
|
@ -179,7 +179,7 @@ module.exports = {
|
||||
gifPage.query = query;
|
||||
gifPage.gifName = gifName;
|
||||
// Generate the embed
|
||||
const gifEmbed = Embeds.core.gifSearch({ author: interaction.user.username }, gifPage);
|
||||
const gifEmbed = Embeds.core.gifSearch({ author: interaction.member.displayName }, gifPage);
|
||||
interaction.editReply({ embeds: [gifEmbed], components: [actionRow], ephemeral: true });
|
||||
});
|
||||
break;
|
||||
|
@ -1,132 +0,0 @@
|
||||
const tenor = require('tenorjs').client({
|
||||
'Key': process.env.tenorAPIKey, // https://tenor.com/developer/keyregistration
|
||||
'Filter': 'off', // "off", "low", "medium", "high", not case sensitive
|
||||
'Locale': 'en_US',
|
||||
'MediaFilter': 'minimal',
|
||||
'DateFormat': 'D/MM/YYYY - H:mm:ss A',
|
||||
});
|
||||
|
||||
const { SlashCommandBuilder } = require('@discordjs/builders');
|
||||
const { Collection } = require('discord.js');
|
||||
const fn = require('../functions.js');
|
||||
const strings = require('../strings.json');
|
||||
const { GifData } = require('../CustomModules/NodBot.js');
|
||||
const customEmbeds = require('../CustomModules/Embeds.js');
|
||||
const Indexer = require('../CustomModules/Indexer.js');
|
||||
const Embeds = require('../CustomModules/Embeds.js');
|
||||
const { emoji } = strings;
|
||||
|
||||
module.exports = {
|
||||
data: new SlashCommandBuilder()
|
||||
.setName('view')
|
||||
.setDescription('View content saved in Nodbot\'s database.')
|
||||
// GIFs
|
||||
.addSubcommand(subcommand =>
|
||||
subcommand
|
||||
.setName('gifs')
|
||||
.setDescription('Display all saved GIFs.')
|
||||
)
|
||||
// Joints
|
||||
.addSubcommand(subcommand =>
|
||||
subcommand
|
||||
.setName('joints')
|
||||
.setDescription('Display all saved joints.')
|
||||
)
|
||||
// Pastas
|
||||
.addSubcommand(subcommand =>
|
||||
subcommand
|
||||
.setName('pastas')
|
||||
.setDescription('Display all saved copypastas.')
|
||||
)
|
||||
// Requests
|
||||
.addSubcommand(subcommand =>
|
||||
subcommand
|
||||
.setName('requests')
|
||||
.setDescription('Display all saved requests.')
|
||||
),
|
||||
async execute(interaction) {
|
||||
await interaction.deferReply({ ephemeral: true });
|
||||
try {
|
||||
// Code Here...
|
||||
const subcommand = interaction.options.getSubcommand();
|
||||
const iStorage = interaction.client.iStorage.get(interaction.id);
|
||||
const commandData = {
|
||||
author: interaction.user.username,
|
||||
command: `/${interaction.commandName} ${subcommand}`
|
||||
};
|
||||
switch (subcommand) {
|
||||
// GIFs
|
||||
case "gifs":
|
||||
if (!interaction.client.gifs) {
|
||||
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);
|
||||
indexedGifs.gifsString = new String();
|
||||
|
||||
iStorage.page = 0;
|
||||
|
||||
for (const gif of indexedGifs.thisPage) {
|
||||
indexedGifs.gifsString += `[${gif.name}.gif](${gif.url})\n`;
|
||||
}
|
||||
interaction.editReply(fn.embeds.gifs(commandData, indexedGifs));
|
||||
break;
|
||||
// Joints
|
||||
case "joints":
|
||||
if (!interaction.client.joints) {
|
||||
interaction.editReply('For some reason I don\'t have access to the collection of joints. Sorry about that!');
|
||||
return;
|
||||
}
|
||||
let indexedJoints = Indexer(interaction.client.joints, 0);
|
||||
indexedJoints.jointsString = new String();
|
||||
|
||||
iStorage.page = 0;
|
||||
|
||||
for (const joint of indexedJoints.thisPage) {
|
||||
indexedJoints.jointsString += `${joint.content}\n`;
|
||||
}
|
||||
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;
|
||||
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:
|
||||
break;
|
||||
}
|
||||
} catch (err) {
|
||||
const errorId = fn.generateErrorId();
|
||||
console.error(`${errorId}: err`);
|
||||
await interaction.editReply(`Sorry, an error has occured. Error ID: ${errorId}`);
|
||||
}
|
||||
}
|
||||
};
|
Loading…
Reference in New Issue
Block a user