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
|
2019-11-07 15:35:23 +08:00
|
|
|
export async function run(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-11-07 15:35:23 +08:00
|
|
|
return server.police.frisk(socket.address, 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);
|
|
|
|
|
2019-11-07 15:35:23 +08:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
export const requiredData = ['cmdKey', 'text'];
|
|
|
|
export const info = {
|
2018-06-04 02:08:35 +08:00
|
|
|
name: 'socketreply',
|
|
|
|
usage: 'Internal Use Only',
|
2019-11-07 15:35:23 +08:00
|
|
|
description: 'Internally used to relay warnings to clients',
|
2018-06-04 02:08:35 +08:00
|
|
|
};
|