From 9a0d37b2b1247ec1447b071945212b4ef551c62b Mon Sep 17 00:00:00 2001 From: loicbersier Date: Sun, 21 Oct 2018 21:12:02 +0200 Subject: [PATCH] disable custom help and reverted to default one --- commands/utility/help.js | 108 --------------------------------------- index.js | 1 - 2 files changed, 109 deletions(-) delete mode 100644 commands/utility/help.js diff --git a/commands/utility/help.js b/commands/utility/help.js deleted file mode 100644 index 146460e..0000000 --- a/commands/utility/help.js +++ /dev/null @@ -1,108 +0,0 @@ -const { stripIndents, oneLine } = require('common-tags'); -const { Command, disambiguation } = require('discord.js-commando'); -const blacklist = require('../../json/blacklist.json') - - -module.exports = class HelpCommand extends Command { - constructor(client) { - super(client, { - name: 'help', - group: 'util', - memberName: 'help', - description: 'Displays a list of available commands, or detailed information for a specified command.', - details: oneLine` - The command may be part of a command name or a whole command name. - If it isn't specified, all available commands will be listed. - `, - examples: ['help', 'help prefix'], - guarded: true, - - args: [ - { - key: 'command', - prompt: 'Which command would you like to view the help for?', - type: 'string', - default: '' - } - ] - }); - } - - async run(msg, args) { // eslint-disable-line complexity - if(blacklist[message.author.id]) - return message.channel.send("You are blacklisted") - - const groups = this.client.registry.groups; - const commands = this.client.registry.findCommands(args.command, false, msg); - const showAll = args.command && args.command.toLowerCase() === 'all'; - if(args.command && !showAll) { - if(commands.length === 1) { - let help = stripIndents` - ${oneLine` - __Command **${commands[0].name}**:__ ${commands[0].description} - ${commands[0].guildOnly ? ' (Usable only in servers)' : ''} - ${commands[0].nsfw ? ' (NSFW)' : ''} - `} - - **Format:** ${msg.anyUsage(`${commands[0].name}${commands[0].format ? ` ${commands[0].format}` : ''}`)} - `; - if(commands[0].aliases.length > 0) help += `\n**Aliases:** ${commands[0].aliases.join(', ')}`; - help += `\n${oneLine` - **Group:** ${commands[0].group.name} - (\`${commands[0].groupID}:${commands[0].memberName}\`) - `}`; - if(commands[0].details) help += `\n**Details:** ${commands[0].details}`; - if(commands[0].examples) help += `\n**Examples:**\n${commands[0].examples.join('\n')}`; - - const messages = []; - try { - messages.push(await msg.direct(help)); - if(msg.channel.type !== 'dm') messages.push(await msg.reply('Sent you a DM with information.')); - } catch(err) { - messages.push(await msg.reply('Unable to send you the help DM. You probably have DMs disabled.')); - } - return messages; - } else if(commands.length > 15) { - return msg.reply('Multiple commands found. Please be more specific.'); - } else if(commands.length > 1) { - return msg.reply(disambiguation(commands, 'commands')); - } else { - return msg.reply( - `Unable to identify command. Use ${msg.usage( - null, msg.channel.type === 'dm' ? null : undefined, msg.channel.type === 'dm' ? null : undefined - )} to view the list of all commands.` - ); - } - } else { - const messages = []; - try { - messages.push(await msg.direct(stripIndents` - ${oneLine` - To run a command in ${msg.guild ? msg.guild.name : 'any server'}, - use ${Command.usage('command', msg.guild ? msg.guild.commandPrefix : null, this.client.user)}. - For example, ${Command.usage('prefix', msg.guild ? msg.guild.commandPrefix : null, this.client.user)}. - `} - To run a command in this DM, simply use ${Command.usage('command', null, null)} with no prefix. - - Use ${this.usage('', null, null)} to view detailed information about a specific command. - Use ${this.usage('all', null, null)} to view a list of *all* commands, not just available ones. - - __**${showAll ? 'All commands' : `Available commands in ${msg.guild || 'this DM'}`}**__ - - ${(showAll ? groups : groups.filter(grp => grp.commands.some(cmd => cmd.isUsable(msg)))) - .map(grp => stripIndents` - __${grp.name}__ - ${(showAll ? grp.commands : grp.commands.filter(cmd => cmd.isUsable(msg))) - .map(cmd => `\`\`${cmd.name}: ${cmd.description}${cmd.nsfw ? ' (NSFW)' : ''}\`\``).join('\n') - } - `).join('\n\n') - } - `, { split: true })); - if(msg.channel.type !== 'dm') messages.push(await msg.reply('Sent you a DM with information.')); - } catch(err) { - messages.push(await msg.reply('Unable to send you the help DM. You probably have DMs disabled.')); - } - return messages; - } - } -}; diff --git a/index.js b/index.js index e18088a..1920b47 100644 --- a/index.js +++ b/index.js @@ -27,7 +27,6 @@ client.registry ]) .registerDefaultGroups() .registerDefaultCommands({ - help: false, ping: false }) .registerCommandsIn(path.join(__dirname, 'commands'));