1
0
mirror of https://github.com/hack-chat/main.git synced 2024-03-22 13:20:33 +08:00
hack-chat-main/server/src/commands/internal/socketreply.js

23 lines
609 B
JavaScript
Raw Normal View History

2018-06-04 02:08:35 +08:00
/*
Description: Used to relay warnings to clients internally
*/
// 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);
};
// 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'
};