From 4b30736929e65ec7ad664b2ffb2d1eca10b0636a Mon Sep 17 00:00:00 2001 From: neelkamath Date: Sat, 12 May 2018 13:52:19 +0530 Subject: Remove help.js as we need human, not programmatic documentation for this --- server/src/commands/core/help.js | 49 ---------------------------------------- 1 file changed, 49 deletions(-) delete mode 100644 server/src/commands/core/help.js (limited to 'server/src') diff --git a/server/src/commands/core/help.js b/server/src/commands/core/help.js deleted file mode 100644 index 331e13f..0000000 --- a/server/src/commands/core/help.js +++ /dev/null @@ -1,49 +0,0 @@ -/* - Description: Outputs the current command module list or command categories -*/ - -const stripIndents = require('common-tags').stripIndents; - -exports.run = async (core, server, socket, data) => { - // verify passed arguments - let typeDt = typeof data.type; - let catDt = typeof data.category; - let cmdDt = typeof data.command; - if (typeDt !== 'undefined' && typeDt !== 'string' ) { - return; - } else if (catDt !== 'undefined' && catDt !== 'string' ) { - return; - } else if (cmdDt !== 'undefined' && cmdDt !== 'string' ) { - return; - } - - // set default reply - let reply = stripIndents`Help usage: - Show all categories -> { cmd: 'help', type: 'categories' } - Show all commands in category -> { cmd: 'help', category: '' } - Show specific command -> { cmd: 'help', command: '' }`; - - if (typeDt !== 'undefined') { - let categories = core.commands.categories().sort(); - reply = `Command Categories:\n${categories.map(c => `- ${c.replace('../src/commands/', '')}`).join('\n')}`; - } else if (catDt !== 'undefined') { - let catCommands = core.commands.all('../src/commands/' + data.category).sort((a, b) => a.info.name.localeCompare(b.info.name)); - reply = `${data.category} commands:\n${catCommands.map(c => `- ${c.info.name}`).join('\n')}`; - } else if (cmdDt !== 'undefined') { - let command = core.commands.get(data.command); - reply = stripIndents` - Usage: ${command.info.usage || command.info.name} - Description: ${command.info.description || '¯\_(ツ)_/¯'}`; - } - - server.reply({ - cmd: 'info', - text: reply - }, socket); -}; - -exports.info = { - name: 'help', - usage: 'help ([ type:categories] | [category: | command: ])', - description: 'Outputs information about the servers current protocol' -}; -- cgit v1.2.1