aboutsummaryrefslogtreecommitdiffstats
path: root/server/src/commands/internal/socketreply.js
blob: e77d0808be0a0cffa3fc3587a7a7db55a1791f85 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
/*
  Description: Used to relay warnings to clients internally
*/

exports.run = async (core, server, socket, data) => {
  if (data.cmdKey !== server._cmdKey) {
    // internal command attempt by client, increase rate limit chance and ignore
    server._police.frisk(socket.remoteAddress, 20);

    return;
  }

  // send warning to target socket
  server.reply({ cmd: 'warn', text: data.text }, socket);
};

exports.requiredData = ['cmdKey', 'text'];

exports.info = {
  name: 'socketreply',
  usage: 'Internal Use Only',
  description: 'Internally used to relay warnings to clients'
};