diff options
author | marzavec <admin@marzavec.com> | 2019-11-07 08:35:23 +0100 |
---|---|---|
committer | marzavec <admin@marzavec.com> | 2019-11-07 08:35:23 +0100 |
commit | f28e65ab8035682372edbe1c11d9ca2581e0a2e6 (patch) | |
tree | a75c9b682ca245baa3f01df5ea704ba95205cef3 /server/src/commands/mod/unban.js | |
parent | Merge pull request #79 from 0x17de/feature-emote-trip (diff) | |
download | hackchat-f28e65ab8035682372edbe1c11d9ca2581e0a2e6.tar.gz hackchat-f28e65ab8035682372edbe1c11d9ca2581e0a2e6.zip |
Syntax update and formatting tweaks
Diffstat (limited to '')
-rw-r--r-- | server/src/commands/mod/unban.js | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/server/src/commands/mod/unban.js b/server/src/commands/mod/unban.js index 6744d9d..0d1e469 100644 --- a/server/src/commands/mod/unban.js +++ b/server/src/commands/mod/unban.js @@ -3,22 +3,23 @@ */ // module main -exports.run = async (core, server, socket, data) => { +export async function run(core, server, socket, data) { // increase rate limit chance and ignore if not admin or mod if (socket.uType === 'user') { - return server.police.frisk(socket.remoteAddress, 10); + return server.police.frisk(socket.address, 10); } // check user input if (typeof data.ip !== 'string' && typeof data.hash !== 'string') { return server.reply({ cmd: 'warn', - text: "hash:'targethash' or ip:'1.2.3.4' is required" + text: "hash:'targethash' or ip:'1.2.3.4' is required", }, socket); } // find target - let mode, target; + let mode; let + target; if (typeof data.ip === 'string') { mode = 'ip'; target = data.ip; @@ -39,23 +40,24 @@ exports.run = async (core, server, socket, data) => { // reply with success server.reply({ cmd: 'info', - text: `Unbanned ${target}` + text: `Unbanned ${target}`, }, socket); // notify mods server.broadcast({ cmd: 'info', - text: `${socket.nick} unbanned: ${target}` + text: `${socket.nick} unbanned: ${target}`, }, { uType: 'mod' }); // stats are fun core.stats.decrement('users-banned'); -}; -// module meta -exports.info = { + return true; +} + +export const info = { name: 'unban', description: 'Removes target ip from the ratelimiter', usage: ` - API: { cmd: 'unban', ip/hash: '<target ip or hash>' }` + API: { cmd: 'unban', ip/hash: '<target ip or hash>' }`, }; |