admin chset

This commit is contained in:
Hri7566 2021-04-12 18:19:16 -04:00
parent 1802c436fc
commit 13a89f76a9
1 changed files with 5 additions and 3 deletions

View File

@ -111,10 +111,12 @@ module.exports = (cl) => {
} }
}); });
cl.on("chset", msg => { cl.on("chset", (msg, admin) => {
if (!(cl.channel && cl.participantId)) return; if (!(cl.channel && cl.participantId)) return;
if (!cl.channel.crown) return; if (!cl.channel.crown && !admin) return;
if (!admin) {
if (!(cl.user._id == cl.channel.crown.userId)) return; if (!(cl.user._id == cl.channel.crown.userId)) return;
}
if (!msg.hasOwnProperty("set") || !msg.set) msg.set = new RoomSettings(cl.channel.settings, 'user'); if (!msg.hasOwnProperty("set") || !msg.set) msg.set = new RoomSettings(cl.channel.settings, 'user');
cl.channel.settings.changeSettings(msg.set); cl.channel.settings.changeSettings(msg.set);
cl.channel.updateCh(); cl.channel.updateCh();