aboutsummaryrefslogtreecommitdiffstats
path: root/server/src/commands/internal/socketreply.js
blob: 1ba8df2e243043150eda1afbdc17df3b9d3f3430 (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
*/

// module main
export async function run(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.address, 20);
  }

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

  return true;
}

export const requiredData = ['cmdKey', 'text'];
export const info = {
  name: 'socketreply',
  usage: 'Internal Use Only',
  description: 'Internally used to relay warnings to clients',
};