mirror of
https://github.com/hack-chat/main.git
synced 2024-03-22 13:20:33 +08:00
7ecb31c46c
Fleshing out the new channel ownership feature, along with a typo fix and small syntax updates. A claim can now be staked with /claimchannel, a channel owner may change a trip's level using /setlevel To do: unclaimchannel, setmotd, makeprivate, makepublic, renewclaim, garbage keeping, update mod commands to accept channelOwner and channelModerator, etc
52 lines
1.4 KiB
JavaScript
52 lines
1.4 KiB
JavaScript
/**
|
|
* @author Marzavec ( https://github.com/marzavec )
|
|
* @summary Bridge warning events to a user
|
|
* @version 1.0.0
|
|
* @description If a warning occurs within the server, this module will relay the warning to the
|
|
* client
|
|
* @module socketreply
|
|
*/
|
|
|
|
/**
|
|
* Executes when invoked by a remote client
|
|
* @param {Object} env - Environment object with references to core, server, socket & payload
|
|
* @public
|
|
* @return {void}
|
|
*/
|
|
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, 20);
|
|
}
|
|
|
|
// send warning to target socket
|
|
return server.reply({
|
|
cmd: 'warn',
|
|
text: payload.text,
|
|
}, socket);
|
|
}
|
|
|
|
/**
|
|
* The following payload properties are required to invoke this module:
|
|
* "cmdKey", "text"
|
|
* @public
|
|
* @typedef {Array} socketreply/requiredData
|
|
*/
|
|
export const requiredData = ['cmdKey', 'text'];
|
|
|
|
/**
|
|
* Module meta information
|
|
* @public
|
|
* @typedef {Object} socketreply/info
|
|
* @property {string} name - Module command name
|
|
* @property {string} category - Module category name
|
|
* @property {string} description - Information about module
|
|
* @property {string} usage - Information about module usage
|
|
*/
|
|
export const info = {
|
|
name: 'socketreply',
|
|
category: 'internal',
|
|
description: 'Internally used to relay warnings to clients',
|
|
usage: 'Internal Use Only',
|
|
};
|