mirror of
https://github.com/hack-chat/main.git
synced 2024-03-22 13:20:33 +08:00
Remove help.js as we need human, not programmatic documentation for this
This commit is contained in:
parent
880b0f7c27
commit
4b30736929
|
@ -11,7 +11,6 @@ The commands are to be sent through a websocket to the URL wss://hack.chat/chat-
|
|||
|`changenick`|`nick`|Changes the current connection's nickname.|
|
||||
|`chat`|`text`|This broadcasts `text` to the channel the user is connected to.|
|
||||
|`disconnect`||An event handler or forced disconnect.|
|
||||
|`help`|`category` or `command`|Gives documentation programmatically. If `category` (the permission level, such as `mod`) is sent, a list of commands available to that permission level will be sent back (as a `string` and not an `array`). This list only includes what is unique to that category and not every command a user with that permission level could perform. If `command` (e.g., `chat`), a description of the command will be sent back.|
|
||||
|`invite`|`nick`|Generates a pseudo-unique channel name and passes it to both the calling user and `nick`.|
|
||||
|`join`|`channel`, `nick`|Places the calling socket into the target channel with the target nick and broadcasts the event to the channel.|
|
||||
|`morestats`||Sends back the current server's stats to the calling client.|
|
||||
|
|
|
@ -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: '<category name>' }
|
||||
Show specific command -> { cmd: 'help', command: '<command name>' }`;
|
||||
|
||||
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:<category name> | command:<command name> ])',
|
||||
description: 'Outputs information about the servers current protocol'
|
||||
};
|
Loading…
Reference in New Issue
Block a user