From f28e65ab8035682372edbe1c11d9ca2581e0a2e6 Mon Sep 17 00:00:00 2001 From: marzavec Date: Wed, 6 Nov 2019 23:35:23 -0800 Subject: Syntax update and formatting tweaks --- server/src/commands/mod/unban.js | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) (limited to 'server/src/commands/mod/unban.js') 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: '' }` + API: { cmd: 'unban', ip/hash: '' }`, }; -- cgit v1.2.1