Updated help command to include subcommands
This commit is contained in:
@@ -9,6 +9,16 @@ module.exports = {
|
|||||||
type: "slash",
|
type: "slash",
|
||||||
dev: false,
|
dev: false,
|
||||||
public: true,
|
public: true,
|
||||||
|
subcommands: [
|
||||||
|
{
|
||||||
|
name: "member",
|
||||||
|
description: "Get info about a guild memeber",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "info",
|
||||||
|
description: "Get info about a guild.",
|
||||||
|
}
|
||||||
|
],
|
||||||
|
|
||||||
data: new SlashCommandBuilder()
|
data: new SlashCommandBuilder()
|
||||||
.setName("guild")
|
.setName("guild")
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ module.exports = {
|
|||||||
name: "help",
|
name: "help",
|
||||||
description: "Help command",
|
description: "Help command",
|
||||||
type: "slash",
|
type: "slash",
|
||||||
dev: false,
|
dev: true,
|
||||||
public: true,
|
public: true,
|
||||||
|
|
||||||
data: new SlashCommandBuilder()
|
data: new SlashCommandBuilder()
|
||||||
@@ -24,10 +24,26 @@ module.exports = {
|
|||||||
const commandFiles = fs.readdirSync(__dirname).filter(file => file.endsWith(".js"))
|
const commandFiles = fs.readdirSync(__dirname).filter(file => file.endsWith(".js"))
|
||||||
for (const file of commandFiles) {
|
for (const file of commandFiles) {
|
||||||
const command = require(`./${file}`)
|
const command = require(`./${file}`)
|
||||||
if (command.public) {
|
if (command.public && !command.subcommands) {
|
||||||
commands.push(command)
|
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) => {
|
const commandList = commands.map((command) => {
|
||||||
return {
|
return {
|
||||||
name: "**/" + command.name + "**",
|
name: "**/" + command.name + "**",
|
||||||
|
|||||||
Reference in New Issue
Block a user