thanks kazukazu123123 (#14)

This commit is contained in:
charsyチャーシィ 2021-02-28 21:04:31 -07:00
parent d9d732d683
commit 3b21ce6d03
2 changed files with 15 additions and 17 deletions

View File

@ -32,20 +32,16 @@ module.exports = (cl) => {
let param;
if (cl.channel.isLobby(cl.channel._id)) {
param = Quota.N_PARAMS_LOBBY;
param.m = "nq";
cl.sendArray([param])
} else {
if (!(cl.user._id == cl.channel.crown.userId)) {
param = Quota.N_PARAMS_NORMAL;
param.m = "nq";
cl.sendArray([param])
} else {
param = Quota.N_PARAMS_RIDICULOUS;
}
}
param.m = "nq";
cl.sendArray([param])
}
}
}
})
cl.on("m", (msg, admin) => {
if (!cl.quotas.cursor.attempt() && !admin) return;
@ -159,12 +155,14 @@ 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 (msg.hasOwnProperty('_id') && typeof msg._id == "string") {
if (!cl.quotas.kickban.attempt() && !admin) return;
let _id = msg._id;
let ms = msg.ms || 0;
let ms = msg.ms || 3600000;
cl.channel.kickban(_id, ms);
}
})

View File

@ -44,8 +44,10 @@ class Room extends EventEmitter {
}
}
this.crowndropped = false;
this.settings = {visible:true,color:this.server.defaultRoomColor,chat:true,crownsolo:false};
} else {
//cl.quotas.a.setParams(Quota.PARAMS_A_NORMAL);
this.settings = {visible:true,color:this.server.defaultRoomColor,chat:true,crownsolo:false,lobby:true};
}
this.ppl.set(participantId, cl);
@ -63,7 +65,7 @@ class Room extends EventEmitter {
m: "c",
c: this.chatmsgs.slice(-1 * 32)
}])
this.updateCh(cl);
this.updateCh(cl, this.settings);
} else {
cl.user.id = otheruser.participantId;
cl.participantId = otheruser.participantId;
@ -73,7 +75,7 @@ class Room extends EventEmitter {
m: "c",
c: this.chatmsgs.slice(-1 * 32)
}])
this.updateCh(cl);
this.updateCh(cl, this.settings);
}
}
@ -297,13 +299,12 @@ class Room extends EventEmitter {
}
kickban(_id, ms) {
ms = parseInt(ms);
if (ms >= (1000 * 60 * 60 - 500)) return;
if (ms >= (1000 * 60 * 60)) return;
if (ms < 0) return;
ms = Math.round(ms / 1000) * 1000;
let user = this.connections.find((usr) => usr.user._id == _id);
if (!user) return;
let asd = true;
let tonc = true;
let pthatbanned = this.ppl.get(this.crown.participantId);
this.connections.filter((usr) => usr.participantId == user.participantId).forEach((u) => {
user.bantime = Math.floor(Math.floor(ms / 1000) / 60);
@ -330,7 +331,7 @@ class Room extends EventEmitter {
"#room",
"short"
)
if (this.crown && (this.crown.userId == _id) && tonc) {
if (this.crown && (this.crown.userId == _id)) {
this.Notification("room",
"Certificate of Award",
`Let it be known that ${user.user.name} kickbanned him/her self.`,
@ -338,7 +339,6 @@ class Room extends EventEmitter {
7000,
"#room"
);
tonc = false;
}
}