From 3162a4132d36e36635135aefee76ba899694a043 Mon Sep 17 00:00:00 2001 From: Unknown Date: Fri, 23 Feb 2018 21:23:18 -0500 Subject: New help --- commands/help.js | 41 +++++++++++++++++++++++++++++------------ 1 file changed, 29 insertions(+), 12 deletions(-) (limited to 'commands/help.js') diff --git a/commands/help.js b/commands/help.js index b0fc395..6e97fcd 100644 --- a/commands/help.js +++ b/commands/help.js @@ -1,14 +1,31 @@ -exports.run = (bot, msg, args) => { +exports.run = (bot, msg) => { const { RichEmbed } = require('discord.js'); - msg.channel.send( - new RichEmbed() - .setColor (0x00ae86) - .setTitle('PokeBot Command List') - .setDescription('These are the commands you can use. My prefix is `p:`') - .addField('Core', 'help\nping', true) - .addField('Utility', 'suggest', true) - .setFooter('PokeBot Beta') - ); + const embed = new RichEmbed(); + embed + .setColor (0x00ae86) + .setDescription('Notice: When using a command do not include "<" and ">".\n(Example: p:suggest Test)') + .setFooter('PokeBot Beta'); + + const categories = []; + const commands = Array.from(bot.commands.keys()); + + commands.forEach(function(x) { + if (!categories.includes(bot.commands.get(x).help.category)) { + categories.push(bot.commands.get(x).help.category); + } + }); + + categories.forEach(function(x) { + let cat = ''; + commands.forEach(function(command) { + if (bot.commands.get(command).help.category == x) { + const usage = bot.commands.get(command).help.usage ? `*${bot.commands.get(command).help.usage}* ` : ''; + cat += `**p:${command}** ${usage}| ${bot.commands.get(command).help.description} \n`; + } + }); + embed.addField(`${x} |`, cat); + }); + msg.channel.send({ embed }); }; exports.conf = { @@ -18,6 +35,6 @@ exports.conf = { exports.help = { name: 'help', - description: 'Help.', - usage: 'help (command)', + description: 'Displays this help message.', + category: 'Getting Started', }; -- cgit v1.2.3