Updated help command to work now
This commit is contained in:
@@ -1,11 +1,12 @@
|
|||||||
const { SlashCommandBuilder } = require("discord.js")
|
const { SlashCommandBuilder } = require("discord.js")
|
||||||
const { color, devMessage } = require("../../config/options.json")
|
const { color, devMessage } = require("../../config/options.json")
|
||||||
|
const fs = require("fs")
|
||||||
|
|
||||||
module.exports = {
|
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()
|
||||||
@@ -19,6 +20,21 @@ module.exports = {
|
|||||||
|
|
||||||
await interaction.deferReply({ ephemeral: true })
|
await interaction.deferReply({ ephemeral: true })
|
||||||
|
|
||||||
|
const commands = []
|
||||||
|
const commandFiles = fs.readdirSync(__dirname).filter(file => file.endsWith(".js"))
|
||||||
|
for (const file of commandFiles) {
|
||||||
|
const command = require(`./${file}`)
|
||||||
|
if (command.public) {
|
||||||
|
commands.push(command)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const commandList = commands.map((command) => {
|
||||||
|
return {
|
||||||
|
name: "**/" + command.name + "**",
|
||||||
|
value: "`" + command.description + "`"
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
const embedColor = Number(color.replace("#", "0x"))
|
const embedColor = Number(color.replace("#", "0x"))
|
||||||
const footerText = interaction.guild ? interaction.guild.name : interaction.user.username + " | " + devMessage
|
const footerText = interaction.guild ? interaction.guild.name : interaction.user.username + " | " + devMessage
|
||||||
const footerIcon = interaction.guild ? interaction.guild.iconURL({ dynamic: true }) : interaction.user.avatarURL({ dynamic: true })
|
const footerIcon = interaction.guild ? interaction.guild.iconURL({ dynamic: true }) : interaction.user.avatarURL({ dynamic: true })
|
||||||
@@ -27,24 +43,7 @@ module.exports = {
|
|||||||
embeds: [{
|
embeds: [{
|
||||||
title: "Commands",
|
title: "Commands",
|
||||||
description: "List of commands",
|
description: "List of commands",
|
||||||
fields: [
|
fields: commandList,
|
||||||
{
|
|
||||||
name: "/check",
|
|
||||||
value: "Check the stats of a player"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "/reqs",
|
|
||||||
value: "Check the requirements of the guild"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "/update",
|
|
||||||
value: "Update's your roles"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "/help",
|
|
||||||
value: "Shows this message"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
color: embedColor,
|
color: embedColor,
|
||||||
thumbnail: {
|
thumbnail: {
|
||||||
url: interaction?.guild?.iconURL({ dynamic: true }) || null
|
url: interaction?.guild?.iconURL({ dynamic: true }) || null
|
||||||
|
|||||||
Reference in New Issue
Block a user