add admin only commands support for help command

This commit is contained in:
SileNce5k 2021-02-19 22:13:22 +01:00
parent 0b6e92a75f
commit c6ed10ae94
No known key found for this signature in database
GPG key ID: C507260E7F2583AD

View file

@ -6,7 +6,7 @@ const {prefix} = require('../config.json');
module.exports = { module.exports = {
name: 'help', name: 'help',
description: 'List all available commands.', description: 'List all available commands.',
execute(message) { execute(message, args) {
var commands = " " var commands = " "
const commandFiles = fs.readdirSync('./commands').filter(file => file.endsWith('.js')); const commandFiles = fs.readdirSync('./commands').filter(file => file.endsWith('.js'));
@ -17,13 +17,16 @@ module.exports = {
.setAuthor("soilens bot", "https://cdn.discordapp.com/avatars/481128222147477506/1a30f57f8e403f54aaca502012aeff14.png?size=2048") .setAuthor("soilens bot", "https://cdn.discordapp.com/avatars/481128222147477506/1a30f57f8e403f54aaca502012aeff14.png?size=2048")
for (const file of commandFiles) { for (const file of commandFiles) {
const command = require(`./${file}`); const command = require(`./${file}`);
console.log(command.name)
var commands = commands + `${prefix}${command.name} | ${command.description}\n`
if(args[0] == "admin"){
if (command.admin)
commands = commands + `${prefix}${command.name} | ${command.description}\n`
}else
if(!command.admin)
commands = commands + `${prefix}${command.name} | ${command.description}\n`
} }
embed.addFields( embed.addFields(
{ name: "General", value: commands }, { name: "General", value: commands },