aboutsummaryrefslogtreecommitdiffstats
path: root/server/src/commands/core/help.js
diff options
context:
space:
mode:
authormarzavec <admin@marzavec.com>2018-06-04 09:07:24 +0200
committermarzavec <admin@marzavec.com>2018-06-04 09:07:24 +0200
commite35fff59ba30e78046c9212e74fce9aef56c6e93 (patch)
treec7d3e0cd75f5a6063d629d4295952488907e9562 /server/src/commands/core/help.js
parentCompleted protocol decoupling (diff)
downloadhackchat-e35fff59ba30e78046c9212e74fce9aef56c6e93.tar.gz
hackchat-e35fff59ba30e78046c9212e74fce9aef56c6e93.zip
cleaned up and commented modules
Diffstat (limited to 'server/src/commands/core/help.js')
-rw-r--r--server/src/commands/core/help.js6
1 files changed, 5 insertions, 1 deletions
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: '<category name>' }
Show specific command -> { cmd: 'help', command: '<command name>' }`;
+ // 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:<category name> | command:<command name> ])',
description: 'Outputs information about the servers current protocol'
-}; \ No newline at end of file
+};