From 28b54e10fa9ce282e97c461ea3b65dc9326c2a44 Mon Sep 17 00:00:00 2001 From: Olly Nicholass Date: Fri, 15 Jan 2021 11:55:47 +0000 Subject: [PATCH] feat(*): Add arguments to help command --- commands.js | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/commands.js b/commands.js index e07a906..f2216cd 100644 --- a/commands.js +++ b/commands.js @@ -17,18 +17,33 @@ module.exports = { }; function commandHelp (Discord, config, logger, message, command, args) { - const msg = ` + const helpMessage = ` The commands available to you are: -- \`${config.prefix}ud \` - Search Urban Dictionary +\`${config.prefix}ud \` - Search Urban Dictionary +\`${config.prefix}help \` - For help with a specific command add the command as an argument `; - message.channel.send(msg); + // Specify specific command help + if (args.length > 0) { + switch (args[0]) { + case 'ud': + message.channel.send(`Usage: \`${config.prefix}ud \` *Example: ${config.prefix}ud yeet*`); + break; + default: + message.channel.send(`That command is not one I know yet - but you could add it! To find out more visit ${config.github_url}`); + } + } + else { + message.channel.send(helpMessage); + } + + } function commandUrbanDictionary(Discord, config, logger, message, command, args) { if (!args.length) { //If the command is used incorrectly without arguments - return message.channel.send(`You didn't provide any arguments, ${message.author}!`); + return message.channel.send(`You didn't provide any arguments, ${message.author}!\nCorrect Usage: \`${config.prefix}ud \``); } else if (args[0] != "") { var searchQuery = args[0];