thanks kazukazu123123 (#14)

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

View File

@ -31,20 +31,16 @@ module.exports = (cl) => {
cl.setChannel(msg._id, msg.set);
let param;
if (cl.channel.isLobby(cl.channel._id)) {
param = Quota.N_PARAMS_LOBBY;
param.m = "nq";
cl.sendArray([param])
param = Quota.N_PARAMS_LOBBY;
} else {
if (!(cl.user._id == cl.channel.crown.userId)) {
param = Quota.N_PARAMS_NORMAL;
param.m = "nq";
cl.sendArray([param])
param = Quota.N_PARAMS_NORMAL;
} else {
param = Quota.N_PARAMS_RIDICULOUS;
param.m = "nq";
cl.sendArray([param])
param = Quota.N_PARAMS_RIDICULOUS;
}
}
param.m = "nq";
cl.sendArray([param])
}
})
cl.on("m", (msg, admin) => {
@ -141,7 +137,7 @@ module.exports = (cl) => {
if (!msg.hasOwnProperty("set") || !msg.set) msg.set = {};
if (msg.set.hasOwnProperty('name') && typeof msg.set.name == "string") {
if (msg.set.name.length > 40) return;
if (!cl.quotas.name.attempt()) return;
if(!cl.quotas.name.attempt()) return;
cl.user.name = msg.set.name;
let user = new User(cl);
user.getUserData().then((usr) => {
@ -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;
}
}