From e35fff59ba30e78046c9212e74fce9aef56c6e93 Mon Sep 17 00:00:00 2001 From: marzavec Date: Mon, 4 Jun 2018 00:07:24 -0700 Subject: cleaned up and commented modules --- server/src/commands/core/help.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'server/src/commands/core/help.js') diff --git a/server/src/commands/core/help.js b/server/src/commands/core/help.js index 7f63d3d..8fd02a1 100644 --- a/server/src/commands/core/help.js +++ b/server/src/commands/core/help.js @@ -5,6 +5,8 @@ const stripIndents = require('common-tags').stripIndents; exports.run = async (core, server, socket, data) => { + // TODO: this module needs to be clean up badly :( + // verify passed arguments let typeDt = typeof data.type; let catDt = typeof data.category; @@ -23,6 +25,7 @@ exports.run = async (core, server, socket, data) => { Show all commands in category -> { cmd: 'help', category: '' } Show specific command -> { cmd: 'help', command: '' }`; + // change reply based on query if (typeDt !== 'undefined') { let categories = core.commands.categories().sort(); reply = `Command Categories:\n${categories.map(c => `- ${c.replace('../src/commands/', '')}`).join('\n')}`; @@ -36,6 +39,7 @@ exports.run = async (core, server, socket, data) => { Description: ${command.info.description || '¯\_(ツ)_/¯'}`; } + // output reply server.reply({ cmd: 'info', text: reply @@ -46,4 +50,4 @@ exports.info = { name: 'help', usage: 'help ([ type:categories] | [category: | command: ])', description: 'Outputs information about the servers current protocol' -}; \ No newline at end of file +}; -- cgit v1.2.1