aboutsummaryrefslogtreecommitdiffstats
path: root/server/src/commands/mod/unban.js
diff options
context:
space:
mode:
authormarzavec <admin@marzavec.com>2018-09-30 08:44:36 +0200
committermarzavec <admin@marzavec.com>2018-09-30 08:44:36 +0200
commitc719020e17cb1c98da55be6cc7efe0e50ab51ffa (patch)
tree4c1e7f05aec2b6a995e21d2bbecbb45c2ae14bd6 /server/src/commands/mod/unban.js
parentMerge pull request #28 from henrywright/27 (diff)
downloadhackchat-c719020e17cb1c98da55be6cc7efe0e50ab51ffa.tar.gz
hackchat-c719020e17cb1c98da55be6cc7efe0e50ab51ffa.zip
Added hooks, modules and cleaned up code
Diffstat (limited to 'server/src/commands/mod/unban.js')
-rw-r--r--server/src/commands/mod/unban.js17
1 files changed, 8 insertions, 9 deletions
diff --git a/server/src/commands/mod/unban.js b/server/src/commands/mod/unban.js
index 9115dbd..0cd8ca7 100644
--- a/server/src/commands/mod/unban.js
+++ b/server/src/commands/mod/unban.js
@@ -2,22 +2,19 @@
Description: Removes a target ip from the ratelimiter
*/
+// module main
exports.run = async (core, server, socket, data) => {
// increase rate limit chance and ignore if not admin or mod
- if (socket.uType == 'user') {
- server._police.frisk(socket.remoteAddress, 10);
-
- return;
+ if (socket.uType === 'user') {
+ return server._police.frisk(socket.remoteAddress, 10);
}
// check user input
if (typeof data.ip !== 'string' && typeof data.hash !== 'string') {
- server.reply({
+ return server.reply({
cmd: 'warn',
text: "hash:'targethash' or ip:'1.2.3.4' is required"
}, socket);
-
- return;
}
// find target
@@ -55,8 +52,10 @@ exports.run = async (core, server, socket, data) => {
core.managers.stats.decrement('users-banned');
};
+// module meta
exports.info = {
name: 'unban',
- usage: 'unban {[ip || hash]}',
- description: 'Removes target ip from the ratelimiter'
+ description: 'Removes target ip from the ratelimiter',
+ usage: `
+ API: { cmd: 'unban', ip/hash: '<target ip or hash>' }`
};