This commit is contained in:
Hri7566 2022-07-09 05:12:13 -04:00
parent 2d0fd503b4
commit 12b6c6b0e4
2 changed files with 34 additions and 4 deletions

View File

@ -647,6 +647,20 @@ class Channel extends EventEmitter {
})
}
unban(_id) {
this.connections.filter((usr) => usr.participantId == user.participantId).forEach(u => {
if (user.bantime) {
delete user.bantime;
}
if (user.bannedtime) {
delete user.bannedtime;
}
this.bans.delete(user.user._id);
});
}
Notification(who, title, text, html, duration, target, klass, id) {
new Notification({
id: id,

View File

@ -212,10 +212,12 @@ module.exports = (cl) => {
});
cl.on('kickban', msg => {
if (cl.channel.crown == null) return;
if (!(cl.channel && cl.participantId)) return;
if (!cl.channel.crown.userId) return;
if (!(cl.user._id == cl.channel.crown.userId)) return;
if (!admin) {
if (cl.channel.crown == null) return;
if (!(cl.channel && cl.participantId)) return;
if (!cl.channel.crown.userId) return;
if (!(cl.user._id == cl.channel.crown.userId)) return;
}
if (msg.hasOwnProperty('_id') && typeof msg._id == "string") {
if (!cl.quotas.kickban.attempt() && !admin) return;
let _id = msg._id;
@ -224,6 +226,20 @@ module.exports = (cl) => {
}
});
cl.on('unban', (msg, admin) => {
if (!admin) {
if (cl.channel.crown == null) return;
if (!(cl.channel && cl.participantId)) return;
if (!cl.channel.crown.userId) return;
if (!(cl.user._id == cl.channel.crown.userId)) return;
}
if (msg.hasOwnProperty('_id') && typeof msg._id == "string") {
if (!cl.quotas.kickban.attempt() && !admin) return;
let _id = msg._id;
cl.channel.unban(_id);
}
});
cl.on("bye", msg => {
cl.user.stopFlagEvents();
cl.destroy();