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
59 lines
1.5 KiB
JavaScript
59 lines
1.5 KiB
JavaScript
/**
|
|
* @author Marzavec ( https://github.com/marzavec )
|
|
* @summary Emit text everywhere
|
|
* @version 1.0.0
|
|
* @description Displays passed text to every client connected
|
|
* @module shout
|
|
*/
|
|
|
|
import {
|
|
isAdmin,
|
|
} from '../utility/_UAC.js';
|
|
|
|
/**
|
|
* 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 }) {
|
|
// increase rate limit chance and ignore if not admin
|
|
if (!isAdmin(socket.level)) {
|
|
return server.police.frisk(socket, 20);
|
|
}
|
|
|
|
// send text to all channels
|
|
server.broadcast({
|
|
cmd: 'info',
|
|
text: `Server Notice: ${payload.text}`,
|
|
channel: false, // @todo Multichannel, false for global
|
|
}, {});
|
|
|
|
return true;
|
|
}
|
|
|
|
/**
|
|
* The following payload properties are required to invoke this module:
|
|
* "text"
|
|
* @public
|
|
* @typedef {Array} shout/requiredData
|
|
*/
|
|
export const requiredData = ['text'];
|
|
|
|
/**
|
|
* Module meta information
|
|
* @public
|
|
* @typedef {Object} shout/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: 'shout',
|
|
category: 'admin',
|
|
description: 'Displays passed text to every client connected',
|
|
usage: `
|
|
API: { cmd: 'shout', text: '<shout text>' }`,
|
|
};
|