aboutsummaryrefslogtreecommitdiffstats
path: root/server/src/commands/core/help.js
blob: 17478d0780cef92ad33becbe9ba61ea974777294 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
/*

*/

'use strict';

exports.run = async (core, server, socket, data) => {
  let reply = `Help usage: { cmd: 'help', type: 'categories'} or { cmd: 'help', type: 'commandname'}`;

  if (typeof data.type === 'undefined') {
    //
  } else {
    if (data.type == 'categories') {
      let categories = core.commands.categories();
      // TODO: bad output, fix this
      reply = `Command Categories:\n${categories}`;
    } else {
      // TODO: finish this module later
    }
  }

  server.reply({
    cmd: 'info',
    text: reply
  }, socket);
};

// optional parameters are marked, all others are required
exports.info = {
  name: 'help', // actual command name
  usage: 'help ([type:categories] | [type:command])',
  description: 'Outputs information about the servers current protocol'
};