diff --git a/src/commands/guild.js b/src/commands/guild.js index 9a1414c..b71d624 100644 --- a/src/commands/guild.js +++ b/src/commands/guild.js @@ -10,20 +10,7 @@ module.exports = { type: "slash", dev: false, public: true, - subcommands: [ - { - name: "member", - description: "Get info about a guild memeber", - }, - { - name: "info", - description: "Get info about a guild.", - }, - { - name: "top", - description: "Get the top guild members based on gexp", - } - ], + subcommands: true, data: new SlashCommandBuilder() .setName("guild") @@ -89,8 +76,6 @@ module.exports = { async execute(interaction) { - await interaction.deferReply() - const subcommand = interaction.options.getSubcommand() const embedColor = Number(color.replace("#", "0x")) @@ -112,7 +97,7 @@ module.exports = { const footerText = interaction.guild ? interaction.guild.name : interaction.user.username const footerIcon = interaction.guild ? interaction.guild.iconURL({ dynamic: true }) : interaction.user.avatarURL({ dynamic: true }) - await interaction.editReply({ + await interaction.reply({ embeds: [{ description: "This command is currently under development", color: embedColor, diff --git a/src/commands/guild/info.js b/src/commands/guild/info.js index c99a462..9848df5 100644 --- a/src/commands/guild/info.js +++ b/src/commands/guild/info.js @@ -4,6 +4,7 @@ const { color, devMessage } = require("../../../config/options.json") /** @param { import('discord.js').ChatInputCommandInteraction } interaction */ async function guildInfo(interaction) { + await interaction.deferReply() const query = interaction.options.getString("query") const type = interaction.options.getString("type") || "ign" diff --git a/src/commands/guild/member.js b/src/commands/guild/member.js index 627ad37..39bb1b7 100644 --- a/src/commands/guild/member.js +++ b/src/commands/guild/member.js @@ -4,6 +4,8 @@ const { color, devMessage } = require("../../../config/options.json") /** @param { import('discord.js').ChatInputCommandInteraction } interaction */ async function guildMember(interaction) { + await interaction.deferReply() + const ign = interaction.options.getString("ign") const embedColor = Number(color.replace("#", "0x")) diff --git a/src/commands/guild/top.js b/src/commands/guild/top.js index 44c7ba5..15f8a10 100644 --- a/src/commands/guild/top.js +++ b/src/commands/guild/top.js @@ -6,6 +6,8 @@ const { redis } = require("../../utils/redis.js") /** @param { import('discord.js').ChatInputCommandInteraction } interaction */ async function guildTop(interaction) { + await interaction.deferReply() + const query = interaction.options.getString("query") const type = interaction.options.getString("type") || "ign" let amount = interaction.options.getNumber("amount") || 10 diff --git a/src/commands/help.js b/src/commands/help.js index 37d8d59..970c64f 100644 --- a/src/commands/help.js +++ b/src/commands/help.js @@ -27,17 +27,15 @@ module.exports = { if (command.public && !command.subcommands) { commands.push(command) } else if (command.public && command.subcommands) { - const commandName = command.name + const commandName = command.data.name - const subcommands = command.subcommands.map((subcommand) => { + const subcommands = command.data.options.map((subcommand) => { return { name: commandName + " " + subcommand.name, description: subcommand.description } }) - console.log(subcommands) - for (const subcommand of subcommands) { commands.push(subcommand) } diff --git a/src/commands/setup.js b/src/commands/setup.js index 492e44a..019a74d 100644 --- a/src/commands/setup.js +++ b/src/commands/setup.js @@ -7,6 +7,7 @@ module.exports = { type: "slash", dev: true, public: false, + subcommands: true, data: new SlashCommandBuilder() .setName("setup") diff --git a/src/commands/staff.js b/src/commands/staff.js index bfe1ff5..30ee6ff 100644 --- a/src/commands/staff.js +++ b/src/commands/staff.js @@ -9,6 +9,7 @@ module.exports = { type: "slash", dev: false, public: false, + subcommands: true, data: new SlashCommandBuilder() .setName("staff") @@ -35,8 +36,6 @@ module.exports = { async execute(interaction) { - await interaction.deferReply() - const subcommand = interaction.options.getSubcommand() const embedColor = Number(color.replace("#", "0x")) @@ -53,7 +52,7 @@ module.exports = { const footerText = interaction.guild ? interaction.guild.name : interaction.user.username const footerIcon = interaction.guild ? interaction.guild.iconURL({ dynamic: true }) : interaction.user.avatarURL({ dynamic: true }) - await interaction.editReply({ + await interaction.reply({ embeds: [{ description: "This command is currently under development", color: embedColor, diff --git a/src/commands/staff/beast.js b/src/commands/staff/beast.js index 4ca01d6..59e8deb 100644 --- a/src/commands/staff/beast.js +++ b/src/commands/staff/beast.js @@ -5,6 +5,7 @@ const { hypixelLevel, bedwarsLevel, skywarsLevel, getUUID, getPlayer, getGuild, /** @param { import('discord.js').ChatInputCommandInteraction } interaction */ async function beast(interaction) { + await interaction.deferReply() const ign = interaction.options.getString("ign") const embedColor = Number(color.replace("#", "0x")) diff --git a/src/commands/staff/help.js b/src/commands/staff/help.js index bf64e84..0102a63 100644 --- a/src/commands/staff/help.js +++ b/src/commands/staff/help.js @@ -5,13 +5,25 @@ const path = require("path") /** @param { import("discord.js").ChatInputCommandInteraction } interaction */ async function help(interaction) { - const commands = [] const commandFiles = fs.readdirSync(path.join(__dirname, "..")).filter(file => file.endsWith(".js")) for (const file of commandFiles) { const command = require(`../../commands/${file}`) - if (!command.public) { + if (!command.public && !command.subcommands) { commands.push(command) + } else if (!command.public && command.subcommands) { + const commandName = command.data.name + + const subcommands = command.data.options.map((subcommand) => { + return { + name: commandName + " " + subcommand.name, + description: subcommand.description + } + }) + + for (const subcommand of subcommands) { + commands.push(subcommand) + } } } const commandList = commands.map((command) => { @@ -25,7 +37,7 @@ async function help(interaction) { const footerText = interaction.guild ? interaction.guild.name : interaction.user.username const footerIcon = interaction.guild ? interaction.guild.iconURL({ dynamic: true }) : interaction.user.avatarURL({ dynamic: true }) - await interaction.editReply({ + await interaction.reply({ embeds: [{ title: "Commands", description: "List of commands", @@ -38,7 +50,8 @@ async function help(interaction) { icon_url: footerIcon, text: footerText + " | " + devMessage } - }] + }], + ephemeral: true }) }