Skip to content
This repository has been archived by the owner on Jul 15, 2024. It is now read-only.

Commit

Permalink
fix: help command
Browse files Browse the repository at this point in the history
  • Loading branch information
wdhdev committed Jun 25, 2023
1 parent d217065 commit 2aeeee4
Showing 1 changed file with 36 additions and 10 deletions.
46 changes: 36 additions & 10 deletions src/commands/user/help.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
const emoji = require("../../config.json").emojis;
const fs = require("fs");
const getDirs = require("../../util/getDirs");

module.exports = {
name: "help",
Expand All @@ -25,24 +26,49 @@ module.exports = {

const commands = [];

const commandFiles = fs.readdirSync(`./src/commands/`).filter(file => file.endsWith(".js"));
async function pushRoot() {
const files = fs.readdirSync(`./src/commands`).filter(file => file.endsWith(".js"));

for(const file of commandFiles) {
const command = require(`./${file}`);
for(const file of files) {
const command = require(`../${file}`);

if(command.name) {
if(!command.enabled || command.hidden) continue;
if(command.name) {
if(!command.enabled || command.hidden) continue;

if(command.default_member_permissions) {
if(!interaction.member.permissions.has(command.default_member_permissions)) continue;
if(command.default_member_permissions) {
if(!interaction.member.permissions.has(command.default_member_permissions)) continue;
}

commands.push(command.name);
} else {
continue;
}
}
}

async function pushDir(dir) {
const files = fs.readdirSync(`./src/commands/${dir}`).filter(file => file.endsWith(".js"));

for(const file of files) {
const command = require(`../${dir}/${file}`);

commands.push(command.name);
} else {
continue;
if(command.name) {
if(!command.enabled || command.hidden) continue;

if(command.default_member_permissions) {
if(!interaction.member.permissions.has(command.default_member_permissions)) continue;
}

commands.push(command.name);
} else {
continue;
}
}
}

await pushRoot();
(await getDirs("./src/commands")).forEach(dir => pushDir(dir));

const cmds = [];

for(const cmd of commands) {
Expand Down

0 comments on commit 2aeeee4

Please sign in to comment.