2018-06-04 02:08:35 +08:00
|
|
|
/*
|
|
|
|
Description: Used to relay warnings to clients internally
|
|
|
|
*/
|
|
|
|
|
2018-09-30 14:44:36 +08:00
|
|
|
// module main
|
2018-06-04 02:08:35 +08:00
|
|
|
exports.run = async (core, server, socket, data) => {
|
2019-04-08 08:04:10 +08:00
|
|
|
if (data.cmdKey !== server.cmdKey) {
|
2018-06-04 02:08:35 +08:00
|
|
|
// internal command attempt by client, increase rate limit chance and ignore
|
2019-04-08 08:04:10 +08:00
|
|
|
return server.police.frisk(socket.remoteAddress, 20);
|
2018-06-04 02:08:35 +08:00
|
|
|
}
|
|
|
|
|
2018-06-04 15:07:24 +08:00
|
|
|
// send warning to target socket
|
2018-06-04 02:08:35 +08:00
|
|
|
server.reply({ cmd: 'warn', text: data.text }, socket);
|
|
|
|
};
|
|
|
|
|
2018-09-30 14:44:36 +08:00
|
|
|
// module meta
|
2018-06-04 02:08:35 +08:00
|
|
|
exports.requiredData = ['cmdKey', 'text'];
|
|
|
|
exports.info = {
|
|
|
|
name: 'socketreply',
|
|
|
|
usage: 'Internal Use Only',
|
|
|
|
description: 'Internally used to relay warnings to clients'
|
|
|
|
};
|