Updated help commands to use command builder
This commit is contained in:
@@ -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"))
|
||||
|
||||
@@ -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
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user