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

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

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

// module meta
exports.requiredData = ['cmdKey', 'text'];
exports.info = {
  name: 'socketreply',
  usage: 'Internal Use Only',
  description: 'Internally used to relay warnings to clients'
};