mirror of
https://github.com/hack-chat/main.git
synced 2024-03-22 13:20:33 +08:00
28 lines
734 B
JavaScript
28 lines
734 B
JavaScript
/*
|
|
Description: Used to relay warnings to clients internally
|
|
*/
|
|
|
|
// module main
|
|
export async function run({ server, socket, payload }) {
|
|
if (payload.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', // @todo Add numeric error code as `id`
|
|
text: payload.text,
|
|
channel: socket.channel || false, // @todo Multichannel
|
|
}, 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',
|
|
};
|