From 72bd216f54f39c41013c2d6b6bd3668a4d84a4d0 Mon Sep 17 00:00:00 2001 From: ry Date: Fri, 3 Jan 2020 17:32:27 +0100 Subject: [PATCH] added needed permissions to command help --- DiscordModules/General/help.js | 52 +++++++++++++++++++--------------- 1 file changed, 29 insertions(+), 23 deletions(-) diff --git a/DiscordModules/General/help.js b/DiscordModules/General/help.js index 821228e..b48a0ab 100755 --- a/DiscordModules/General/help.js +++ b/DiscordModules/General/help.js @@ -1,12 +1,14 @@ const Command = require('../../src/structures/Command'); -const { MessageEmbed } = require('discord.js'); +const { + MessageEmbed +} = require('discord.js'); module.exports = class Help extends Command { constructor() { super({ name: 'help', description: 'View a list of available commands or information on a specific command.', - aliases: [ 'h' ], + aliases: ['h'], module: 'General', cooldown: 0, guildOnly: false, @@ -15,8 +17,8 @@ module.exports = class Help extends Command { } async command(ctx) { - console.log(ctx.args); - let silent = [ '--nd', '--no-dev' ]; + //console.log(ctx.args); + let silent = ['--nd', '--no-dev']; if (ctx.args.includes(silent)) { console.log('is silent'); } @@ -25,9 +27,9 @@ module.exports = class Help extends Command { [ 'General', ctx.client.commands - .filter((command) => command.module == 'General') - .map((command) => `${command.name}`) - .join(' | ') + .filter((command) => command.module == 'General') + .map((command) => `${command.name}`) + .join(' | ') ], /* [ 'Images', @@ -39,23 +41,23 @@ module.exports = class Help extends Command { [ 'Images', ctx.client.commands - .filter((command) => command.module == 'Images') - .map((command) => `${command.name}`) - .join(' | ') + .filter((command) => command.module == 'Images') + .map((command) => `${command.name}`) + .join(' | ') ], [ 'Roleplay', ctx.client.commands - .filter((command) => command.module == 'Roleplay') - .map((command) => `${command.name}`) - .join(' | ') + .filter((command) => command.module == 'Roleplay') + .map((command) => `${command.name}`) + .join(' | ') ], [ 'Settings', ctx.client.commands - .filter((command) => command.module == 'Settings') - .map((command) => `${command.name}`) - .join(' | ') + .filter((command) => command.module == 'Settings') + .map((command) => `${command.name}`) + .join(' | ') ] ]; @@ -63,9 +65,9 @@ module.exports = class Help extends Command { commands.push([ 'Developers', ctx.client.commands - .filter((command) => command.module == 'Developers') - .map((command) => `${command.name}`) - .join(' | ') + .filter((command) => command.module == 'Developers') + .map((command) => `${command.name}`) + .join(' | ') ]); return ctx.send({ @@ -83,12 +85,11 @@ module.exports = class Help extends Command { } else { const command = ctx.client.commands.find( (c) => - c.name == ctx.args[0].toLowerCase() || (c.aliases && c.aliases.includes(ctx.args[0].toLowerCase())) + c.name == ctx.args[0].toLowerCase() || (c.aliases && c.aliases.includes(ctx.args[0].toLowerCase())) ); if (!command) return ctx.send(`That command couldn't be found. Use \`'help\` to see all commands.`); - let fields = [ - { + let fields = [{ name: 'Module', value: command.module, inline: true @@ -108,6 +109,11 @@ module.exports = class Help extends Command { value: command.guildOnly ? 'Yes' : 'No', inline: true }, + { + name: 'Permissions needed', + value: command.AuthorPermissions ? command.AuthorPermissions : 'None', + inline: true + }, { name: 'Developers only?', value: command.developerOnly ? 'Yes' : 'No', @@ -126,4 +132,4 @@ module.exports = class Help extends Command { return ctx.send(embed); } } -}; +}; \ No newline at end of file