mirror of
https://github.com/hack-chat/main.git
synced 2024-03-22 13:20:33 +08:00
Merge pull request #98 from MinusGix/BanMinor
More verbose ban event + UAC getUserDetails additions
This commit is contained in:
commit
be310af3bd
|
@ -46,12 +46,16 @@ export async function run(core, server, socket, data) {
|
|||
server.broadcast({
|
||||
cmd: 'info',
|
||||
text: `Banned ${targetNick}`,
|
||||
user: UAC.getUserDetails(badClient),
|
||||
}, { channel: socket.channel, level: (level) => level < UAC.levels.moderator });
|
||||
|
||||
// notify mods
|
||||
server.broadcast({
|
||||
cmd: 'info',
|
||||
text: `${socket.nick}#${socket.trip} banned ${targetNick} in ${socket.channel}, userhash: ${badClient.hash}`,
|
||||
channel: socket.channel,
|
||||
user: UAC.getUserDetails(badClient),
|
||||
banner: UAC.getUserDetails(socket),
|
||||
}, { level: UAC.isModerator });
|
||||
|
||||
// force connection closed
|
||||
|
|
|
@ -90,6 +90,23 @@ export function isTrustedUser(level) {
|
|||
return level >= levels.trustedUser;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return an object containing public information about the socket
|
||||
* @public
|
||||
* @param {WebSocket} socket Target client
|
||||
* @return {Object}
|
||||
*/
|
||||
export function getUserDetails(socket) {
|
||||
return {
|
||||
uType: socket.uType,
|
||||
nick: socket.nick,
|
||||
trip: socket.trip || 'null',
|
||||
hash: socket.hash,
|
||||
level: socket.level,
|
||||
userid: socket.userid,
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the nickname is valid
|
||||
* @public
|
||||
|
|
Loading…
Reference in New Issue
Block a user