diff options
author | marzavec <admin@marzavec.com> | 2018-05-20 00:15:34 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-05-20 00:15:34 +0200 |
commit | 7ccbf56eebc341e78737d0ff7e2a6a3c47a62281 (patch) | |
tree | 26d944fa1f36480264b7790aef5285393e97fcdd /server/src/commands/core | |
parent | Highlight Hotfix (diff) | |
parent | npm has been pkged with node for awhile now; we neednt list every pkg manager... (diff) | |
download | hackchat-7ccbf56eebc341e78737d0ff7e2a6a3c47a62281.tar.gz hackchat-7ccbf56eebc341e78737d0ff7e2a6a3c47a62281.zip |
Merge pull request #12 from neelkamath/master
Documentation
Diffstat (limited to 'server/src/commands/core')
-rw-r--r-- | server/src/commands/core/changenick.js | 2 | ||||
-rw-r--r-- | server/src/commands/core/chat.js | 4 | ||||
-rw-r--r-- | server/src/commands/core/disconnect.js | 4 | ||||
-rw-r--r-- | server/src/commands/core/help.js | 4 | ||||
-rw-r--r-- | server/src/commands/core/invite.js | 4 | ||||
-rw-r--r-- | server/src/commands/core/join.js | 4 | ||||
-rw-r--r-- | server/src/commands/core/morestats.js | 4 | ||||
-rw-r--r-- | server/src/commands/core/move.js | 4 | ||||
-rw-r--r-- | server/src/commands/core/showcase.js | 53 | ||||
-rw-r--r-- | server/src/commands/core/stats.js | 4 |
10 files changed, 8 insertions, 79 deletions
diff --git a/server/src/commands/core/changenick.js b/server/src/commands/core/changenick.js index 6b2932c..4041bb0 100644 --- a/server/src/commands/core/changenick.js +++ b/server/src/commands/core/changenick.js @@ -2,8 +2,6 @@ Description: Generates a semi-unique channel name then broadcasts it to each client */ -'use strict'; - const verifyNickname = (nick) => { return /^[a-zA-Z0-9_]{1,24}$/.test(nick); }; diff --git a/server/src/commands/core/chat.js b/server/src/commands/core/chat.js index ee45425..bce6adb 100644 --- a/server/src/commands/core/chat.js +++ b/server/src/commands/core/chat.js @@ -2,8 +2,6 @@ Description: Rebroadcasts any `text` to all clients in a `channel` */ -'use strict'; - const parseText = (text) => { if (typeof text !== 'string') { return false; @@ -61,4 +59,4 @@ exports.info = { name: 'chat', usage: 'chat {text}', description: 'Broadcasts passed `text` field to the calling users channel' -}; +};
\ No newline at end of file diff --git a/server/src/commands/core/disconnect.js b/server/src/commands/core/disconnect.js index 1a9c635..9b54214 100644 --- a/server/src/commands/core/disconnect.js +++ b/server/src/commands/core/disconnect.js @@ -4,8 +4,6 @@ by a client to have the connection severed. */ -'use strict'; - exports.run = async (core, server, socket, data) => { if (socket.channel) { server.broadcast({ @@ -20,4 +18,4 @@ exports.run = async (core, server, socket, data) => { exports.info = { name: 'disconnect', description: 'Event handler or force disconnect (if your into that kind of thing)' -}; +};
\ No newline at end of file diff --git a/server/src/commands/core/help.js b/server/src/commands/core/help.js index 71cc745..7f63d3d 100644 --- a/server/src/commands/core/help.js +++ b/server/src/commands/core/help.js @@ -2,8 +2,6 @@ Description: Outputs the current command module list or command categories */ -'use strict'; - const stripIndents = require('common-tags').stripIndents; exports.run = async (core, server, socket, data) => { @@ -48,4 +46,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 diff --git a/server/src/commands/core/invite.js b/server/src/commands/core/invite.js index bd85812..bcf9097 100644 --- a/server/src/commands/core/invite.js +++ b/server/src/commands/core/invite.js @@ -2,8 +2,6 @@ Description: Generates a semi-unique channel name then broadcasts it to each client */ -'use strict'; - const verifyNickname = (nick) => { return /^[a-zA-Z0-9_]{1,24}$/.test(nick); }; @@ -64,4 +62,4 @@ exports.info = { name: 'invite', usage: 'invite {nick}', description: 'Generates a unique (more or less) room name and passes it to two clients' -}; +};
\ No newline at end of file diff --git a/server/src/commands/core/join.js b/server/src/commands/core/join.js index 82b48d2..f2b2c9d 100644 --- a/server/src/commands/core/join.js +++ b/server/src/commands/core/join.js @@ -2,8 +2,6 @@ Description: Initial entry point, applies `channel` and `nick` to the calling socket */ -'use strict'; - const crypto = require('crypto'); const hash = (password) => { @@ -134,4 +132,4 @@ exports.info = { name: 'join', usage: 'join {channel} {nick}', description: 'Place calling socket into target channel with target nick & broadcast event to channel' -}; +};
\ No newline at end of file diff --git a/server/src/commands/core/morestats.js b/server/src/commands/core/morestats.js index d8bc23d..5510cb1 100644 --- a/server/src/commands/core/morestats.js +++ b/server/src/commands/core/morestats.js @@ -2,8 +2,6 @@ Description: Outputs more info than the legacy stats command */ -'use strict'; - const stripIndents = require('common-tags').stripIndents; const formatTime = (time) => { @@ -52,4 +50,4 @@ exports.run = async (core, server, socket, data) => { exports.info = { name: 'morestats', description: 'Sends back current server stats to the calling client' -}; +};
\ No newline at end of file diff --git a/server/src/commands/core/move.js b/server/src/commands/core/move.js index 862025c..c5efafd 100644 --- a/server/src/commands/core/move.js +++ b/server/src/commands/core/move.js @@ -2,8 +2,6 @@ Description: Generates a semi-unique channel name then broadcasts it to each client */ -'use strict'; - exports.run = async (core, server, socket, data) => { if (server._police.frisk(socket.remoteAddress, 6)) { server.reply({ @@ -82,4 +80,4 @@ exports.info = { name: 'move', usage: 'move {channel}', description: 'This will change the current channel to the new one provided' -}; +};
\ No newline at end of file diff --git a/server/src/commands/core/showcase.js b/server/src/commands/core/showcase.js deleted file mode 100644 index 5eca4a2..0000000 --- a/server/src/commands/core/showcase.js +++ /dev/null @@ -1,53 +0,0 @@ -/* - Description: This is a template module that should not be on prod -*/ - -'use strict'; - -// you can require() modules here - -// this function will only be only in the scope of the module -const createReply = (echoInput) => { - if (echoInput.length > 100) - echoInput = 'HOW ABOUT NO?'; - - return `You want me to echo: ${echoInput}?` -}; - -/* - `exports.run()` is required and will always be passed (core, server, socket, data) - - be sure it's async too - this is the main function that will run when called -*/ -exports.run = async (core, server, socket, data) => { - - server.reply({ - cmd: 'info', - text: `SHOWCASE MODULE: ${core.showcase} - ${createReply(data.echo)}` - }, socket); - -}; - -/* - `exports.init()` is optional, and will only be run when the module is loaded into memory - it will always be passed a reference to the global core class - note: this will fire again if a reload is issued, keep that in mind -*/ -exports.init = (core) => { - if (typeof core.showcase === 'undefined') { - core.showcase = 'init is a handy place to put global data by assigning it to `core`'; - } -} - -// optional, if `data.echo` is missing `exports.run()` will never be called & the user will be alerted -// remember; this will only verify that the data is not undefined, not the type of data -exports.requiredData = ['echo']; - -// optional parameters are marked, all others are required -exports.info = { - name: 'showcase', // actual command name - aliases: ['templateModule'], // optional, an array of other names this module can be executed by - usage: 'showcase {echo}', // used for help output, can be ommited if no parameters are required - description: 'Simple command module template & info' // used for help output -}; diff --git a/server/src/commands/core/stats.js b/server/src/commands/core/stats.js index a1abddb..b9dc002 100644 --- a/server/src/commands/core/stats.js +++ b/server/src/commands/core/stats.js @@ -2,8 +2,6 @@ Description: Legacy stats output, kept for compatibility, outputs user and channel count */ -'use strict'; - exports.run = async (core, server, socket, data) => { let ips = {}; let channels = {}; @@ -31,4 +29,4 @@ exports.run = async (core, server, socket, data) => { exports.info = { name: 'stats', description: 'Sends back legacy server stats to the calling client' -}; +};
\ No newline at end of file |