Consolidate setupinfo into setup

This commit is contained in:
Skylar Grant 2023-02-19 19:26:14 -05:00
parent fdfc2fc88a
commit 56a75c3af5
2 changed files with 16 additions and 23 deletions

View File

@ -36,6 +36,9 @@ module.exports = {
.setRequired(false) .setRequired(false)
) )
) )
.addSubcommand(sc =>
sc.setName('view')
.setDescription('View your server\'s configuration'))
.setDefaultMemberPermissions(PermissionFlagsBits.Administrator), .setDefaultMemberPermissions(PermissionFlagsBits.Administrator),
async execute(interaction) { async execute(interaction) {
await interaction.deferReply({ ephemeral: true }); await interaction.deferReply({ ephemeral: true });
@ -71,6 +74,19 @@ module.exports = {
await interaction.editReply(fn.builders.embeds.treeRoleMenu(guildInfo)).catch(e => console.error(e)); await interaction.editReply(fn.builders.embeds.treeRoleMenu(guildInfo)).catch(e => console.error(e));
} }
break; break;
case "view":
try {
if (interaction.client.guildInfos.has(interaction.guildId)) {
let guildInfo = interaction.client.guildInfos.get(interaction.guildId);
await interaction.editReply(fn.builders.embed(guildInfo.generateSetupInfo()));
} else {
await interaction.editReply(fn.builders.errorEmbed("Guild doesn't exist in database!"));
}
} catch (err) {
console.error(err);
await interaction.editReply(fn.builders.errorEmbed("There was an error running the command."));
}
break;
default: default:
break; break;
} }

View File

@ -1,23 +0,0 @@
const { SlashCommandBuilder, PermissionFlagsBits } = require('discord.js');
const fn = require('../modules/functions.js');
module.exports = {
data: new SlashCommandBuilder()
.setName('setupinfo')
.setDescription('View information about how the bot is set up in your server')
.setDefaultMemberPermissions(PermissionFlagsBits.Administrator),
async execute(interaction) {
await interaction.deferReply({ ephemeral: true }).catch(e => console.error(e));
try {
if (interaction.client.guildInfos.has(interaction.guildId)) {
let guildInfo = interaction.client.guildInfos.get(interaction.guildId);
await interaction.editReply(fn.builders.embed(guildInfo.generateSetupInfo()));
} else {
await interaction.editReply(fn.builders.errorEmbed("Guild doesn't exist in database!"));
}
} catch (err) {
console.error(err);
await interaction.editReply(fn.builders.errorEmbed("There was an error running the command."));
}
},
};