diff --git a/src/commands/ban.js b/src/commands/ban.js index f31794e..dd0e0a0 100644 --- a/src/commands/ban.js +++ b/src/commands/ban.js @@ -11,7 +11,7 @@ module.exports = { data: new SlashCommandBuilder() .setName("ban") - .setDescription("Ban a user") + .setDescription("Bans a user") .addUserOption(option => option .setName("user") diff --git a/src/commands/guild.js b/src/commands/guild.js index d1b2ba6..fa513a0 100644 --- a/src/commands/guild.js +++ b/src/commands/guild.js @@ -9,6 +9,16 @@ 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.", + } + ], data: new SlashCommandBuilder() .setName("guild") @@ -31,7 +41,7 @@ module.exports = { .addStringOption(option => option .setName("query") - .setDescription("The IGN of a member.") + .setDescription("The query to search for. [Default: player]") .setRequired(true) ). addStringOption(option => diff --git a/src/commands/guild/info.js b/src/commands/guild/info.js index 4498188..ab965e7 100644 --- a/src/commands/guild/info.js +++ b/src/commands/guild/info.js @@ -127,7 +127,8 @@ async function guildInfo(interaction) { const guildOwner = guildMembers.find((m) => m.rank === "Guild Master").uuid const guildOwnerName = await getIGN(guildOwner) - const guildRanks = guild.ranks.map((r) => "**➺ " + r.name + "** `[" + r.tag + "]`").join("\n") + const guildRanksUnsorted = guild.ranks.sort((a, b) => b.priority - a.priority) + const guildRanks = guildRanksUnsorted.map((r) => "**➺ " + r.name + "** `[" + r.tag + "]`").join("\n") const guildMembersDailyXP = Object.values(guildMembers).map((m) => m.expHistory[Object.keys(m.expHistory)[0]]) const totalGuildMembersDailyXPUnformatted = guildMembersDailyXP.reduce((a, b) => a + b, 0) diff --git a/src/commands/help.js b/src/commands/help.js index 158caa7..37d8d59 100644 --- a/src/commands/help.js +++ b/src/commands/help.js @@ -11,7 +11,7 @@ module.exports = { data: new SlashCommandBuilder() .setName("help") - .setDescription("Help command") + .setDescription("List's all commands usable by a member") .setDMPermission(true), /** @param { import('discord.js').ChatInputCommandInteraction } interaction */ @@ -24,10 +24,26 @@ module.exports = { const commandFiles = fs.readdirSync(__dirname).filter(file => file.endsWith(".js")) for (const file of commandFiles) { const command = require(`./${file}`) - if (command.public) { + if (command.public && !command.subcommands) { commands.push(command) + } else if (command.public && command.subcommands) { + const commandName = command.name + + const subcommands = command.subcommands.map((subcommand) => { + return { + name: commandName + " " + subcommand.name, + description: subcommand.description + } + }) + + console.log(subcommands) + + for (const subcommand of subcommands) { + commands.push(subcommand) + } } } + const commandList = commands.map((command) => { return { name: "**/" + command.name + "**", diff --git a/src/commands/ping.js b/src/commands/ping.js index c1c1618..f7cd433 100644 --- a/src/commands/ping.js +++ b/src/commands/ping.js @@ -10,7 +10,7 @@ module.exports = { data: new SlashCommandBuilder() .setName("ping") - .setDescription("Get the bot's ping."), + .setDescription("Get's the bot's ping."), /** * @param { import("discord.js").ChatInputCommandInteraction } interaction diff --git a/src/commands/update.js b/src/commands/update.js index 119cab2..ab03246 100644 --- a/src/commands/update.js +++ b/src/commands/update.js @@ -14,7 +14,7 @@ module.exports = { data: new SlashCommandBuilder() .setName("update") - .setDescription("Update your guild rank.") + .setDescription("Update your discord roles.") .setDMPermission(false), /** @param { import('discord.js').ChatInputCommandInteraction } interaction */ diff --git a/src/events/server/interactions/logBtnsCmds.js b/src/events/server/interactions/logBtnsCmds.js index b317c06..cf021fd 100644 --- a/src/events/server/interactions/logBtnsCmds.js +++ b/src/events/server/interactions/logBtnsCmds.js @@ -8,10 +8,16 @@ module.exports = { execute(interaction) { if (interaction.isCommand()) { - console.log(interaction.user.username + "#" + - interaction.user.discriminator + " ran " + - interaction.commandName - ) + try { + console.log(interaction.user.username + " ran " + + interaction.commandName + " " + + interaction.options.getSubcommand() + ) + } catch { + console.log(interaction.user.username + " ran " + + interaction.commandName + ) + } } else if (interaction.isButton()) { console.log(interaction.user.username + "#" + interaction.user.discriminator + " clicked " +