From b62f5aeef1c5e0b3853c1c7239aa1a0119f13059 Mon Sep 17 00:00:00 2001 From: mudkipscience Date: Tue, 10 Mar 2020 12:20:28 +1100 Subject: [PATCH] help is now cooler n stuff --- changes.txt | 2 +- src/commands/help.js | 19 ++++++++++++------- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/changes.txt b/changes.txt index 25e245c..e3ed03b 100644 --- a/changes.txt +++ b/changes.txt @@ -3,4 +3,4 @@ Bots now get a bot badge in the userinfo command Added dogfact and catfact command (terry) index.js now has better logging of when things fail to load/initialize (terry) added `dice`, rolls a 6 sided die (terry) -Added two new events, disconnect.js and reconnection.js. Should log when the bot loses connection/reconnects to discord (terry) \ No newline at end of file +Help command changed, the amount of commands in each category and overall is now displayed \ No newline at end of file diff --git a/src/commands/help.js b/src/commands/help.js index 9ccb578..c9744a2 100644 --- a/src/commands/help.js +++ b/src/commands/help.js @@ -4,6 +4,7 @@ exports.run = (client, message, args, level) => { var ran = false; var output = ""; + var commands = 0; var prefix; var currentCategory; @@ -14,7 +15,7 @@ exports.run = (client, message, args, level) => { }; if(!args[0]) { - embed.setTitle("Command list"); + embed.setTitle(`Commands [${client.commands.size}]`); embed.setDescription(`⁣For more information on a specific command use \`${prefix}help \`\nFor the full command list use \`${prefix}help all\`\n`); const myCommands = message.guild ? client.commands.filter( @@ -37,16 +38,18 @@ exports.run = (client, message, args, level) => { const cat = c.help.category.toProperCase(); if (currentCategory !== cat) { if(ran == true) { - embed.addField(currentCategory + ":", output.slice(0, -6)) + embed.addField(currentCategory + ` [${commands}]`, output.slice(0, -2)) output = ""; + commands = 0; } currentCategory = cat; ran = true } - output += `\`${prefix}${c.help.name}\`**,** `; + output += `\`${prefix}${c.help.name}\`, `; + commands = commands + 1; }); - embed.addField(currentCategory + ":", output.slice(0, -6)); + embed.addField(currentCategory + ` [${commands}]`, output.slice(0, -2)); embed.addField( "Invite me", @@ -84,16 +87,18 @@ exports.run = (client, message, args, level) => { const cat = c.help.category.toProperCase(); if (currentCategory !== cat) { if(ran == true) { - embed.addField(currentCategory + ":", output.slice(0, -6)) + embed.addField(currentCategory + ` [${commands}]`, output.slice(0, -2)) output = ""; + commands = 0; } currentCategory = cat; ran = true } - output += `\`${prefix}${c.help.name}\`**,** `; + output += `\`${prefix}${c.help.name}\`, `; + commands = commands + 1; }); - embed.addField(currentCategory + ":", output.slice(0, -6)); + embed.addField(currentCategory + ` [${commands}]`, output.slice(0, -2)); embed.addField( "Invite me",