aboutsummaryrefslogtreecommitdiffstats
path: root/server/src/commands/mod/unban.js
blob: cc1016a69d486316c8c71d52f65404952611140c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
/*

*/

'use strict';

exports.run = async (core, server, socket, data) => {
  if (socket.uType == 'user') {
    // ignore if not mod or admin
    return;
  }

  let ip = String(data.ip);
  let nick = String(data.nick); // for future upgrade

  // TODO: remove ip from ratelimiter
  // POLICE.pardon(ip)
  console.log(`${socket.nick} [${socket.trip}] unbanned ${/*nick || */ip} in ${socket.channel}`);

  server.reply({
    cmd: 'info',
    text: `Unbanned ${/*nick || */ip}`
  }, socket);

  core.managers.stats.decrement('users-banned');
};

exports.requiredData = ['ip'];

exports.info = {
  name: 'unban',
  usage: 'unban {ip}',
  description: 'Removes target ip from the ratelimiter'
};