From 56a75c3af5b14e5222b155efec333fc8541024ba Mon Sep 17 00:00:00 2001 From: Skylar Grant Date: Sun, 19 Feb 2023 19:26:14 -0500 Subject: [PATCH] Consolidate setupinfo into setup --- slash-commands/setup.js | 16 ++++++++++++++++ slash-commands/setupinfo.js | 23 ----------------------- 2 files changed, 16 insertions(+), 23 deletions(-) delete mode 100755 slash-commands/setupinfo.js diff --git a/slash-commands/setup.js b/slash-commands/setup.js index 3ac0069..b24133e 100755 --- a/slash-commands/setup.js +++ b/slash-commands/setup.js @@ -36,6 +36,9 @@ module.exports = { .setRequired(false) ) ) + .addSubcommand(sc => + sc.setName('view') + .setDescription('View your server\'s configuration')) .setDefaultMemberPermissions(PermissionFlagsBits.Administrator), async execute(interaction) { await interaction.deferReply({ ephemeral: true }); @@ -71,6 +74,19 @@ module.exports = { await interaction.editReply(fn.builders.embeds.treeRoleMenu(guildInfo)).catch(e => console.error(e)); } 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: break; } diff --git a/slash-commands/setupinfo.js b/slash-commands/setupinfo.js deleted file mode 100755 index be409c6..0000000 --- a/slash-commands/setupinfo.js +++ /dev/null @@ -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.")); - } - }, -}; \ No newline at end of file