Updated help command to include subcommands
This commit is contained in:
@@ -6,7 +6,7 @@ module.exports = {
|
||||
name: "help",
|
||||
description: "Help command",
|
||||
type: "slash",
|
||||
dev: false,
|
||||
dev: true,
|
||||
public: true,
|
||||
|
||||
data: new SlashCommandBuilder()
|
||||
@@ -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 + "**",
|
||||
|
||||
Reference in New Issue
Block a user