aboutsummaryrefslogtreecommitdiffstats
path: root/server/src/commands/mod/unban.js
diff options
context:
space:
mode:
Diffstat (limited to 'server/src/commands/mod/unban.js')
-rw-r--r--server/src/commands/mod/unban.js22
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>' }`,
};