mirror of
https://github.com/hack-chat/main.git
synced 2024-03-22 13:20:33 +08:00
Created speak.js
This commit is contained in:
parent
c615992efa
commit
bf2d064679
43
server/src/commands/mod/speak.js
Normal file
43
server/src/commands/mod/speak.js
Normal file
@ -0,0 +1,43 @@
|
||||
/*
|
||||
* Description: Pardon a dumb user to be able to speak again
|
||||
* Author: simple
|
||||
*/
|
||||
|
||||
|
||||
exports.run = async (core, server, socket, data) => {
|
||||
if (socket.uType == 'user') {
|
||||
// ignore if not mod or admin
|
||||
return;
|
||||
}
|
||||
|
||||
if (typeof data.ip !== 'string' && typeof data.hash !== 'string') {
|
||||
server.reply({
|
||||
cmd: 'warn',
|
||||
text: "hash:'targethash' or ip:'1.2.3.4' is required"
|
||||
}, socket);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
let target;
|
||||
|
||||
if (typeof data.ip === 'string') {
|
||||
target = getSocketHash(data.ip);
|
||||
} else {
|
||||
target = data.hash;
|
||||
}
|
||||
|
||||
delete core.muzzledHashes[target];
|
||||
|
||||
server.broadcast({
|
||||
cmd: 'info',
|
||||
text: `${socket.nick} unmuzzled : ${target}`
|
||||
}, { uType: 'mod' });
|
||||
|
||||
}
|
||||
|
||||
exports.info = {
|
||||
name: 'speak',
|
||||
usage: 'speak {[ip || hash]}',
|
||||
description: 'Pardon a dumb user to be able to speak again'
|
||||
};
|
Loading…
x
Reference in New Issue
Block a user