From 75002ec47db4362d3b4eecf34065320bc8853658 Mon Sep 17 00:00:00 2001 From: Hri7566 Date: Sat, 9 Jul 2022 00:38:32 -0400 Subject: [PATCH] implement remove crown, fix crown bugs --- .env | 5 +++-- config.js | 4 ++-- mpp.hri7566.info | 1 + src/Channel.js | 7 +++++-- src/Message.js | 7 +++++-- 5 files changed, 16 insertions(+), 8 deletions(-) create mode 160000 mpp.hri7566.info diff --git a/.env b/.env index efc09ff..3f6d0d5 100644 --- a/.env +++ b/.env @@ -1,6 +1,7 @@ ADMINPASS=burgerass SALT=๖ۣۜH͜r̬i͡7566 -MONGO_URL=mongodb://7566:Phillies11@127.0.0.1/?authSource=admin&readPreference=primary&appname=MongoDB%20Compass&ssl=false -SSL=true +# MONGO_URL=mongodb://7566:Phillies11@127.0.0.1/?authSource=admin&readPreference=primary&appname=MongoDB%20Compass&ssl=false +MONGO_URL=mongodb://127.0.0.1 +SSL=false MPPCLONE_TOKEN=056921b5199a52cf926baaed.15646cde-7a71-40d5-880c-5b283265c6fd diff --git a/config.js b/config.js index 2a1a94d..a2f1411 100644 --- a/config.js +++ b/config.js @@ -22,6 +22,6 @@ module.exports = Object.seal({ visible: true }, - hostDevFiles: false, - enableMPPCloneBot: true + hostDevFiles: true, + enableMPPCloneBot: false }); diff --git a/mpp.hri7566.info b/mpp.hri7566.info new file mode 160000 index 0000000..91ff834 --- /dev/null +++ b/mpp.hri7566.info @@ -0,0 +1 @@ +Subproject commit 91ff8343d35176eb8bcfb4c51396871a7ddac5b6 diff --git a/src/Channel.js b/src/Channel.js index 0ecea73..e77970e 100644 --- a/src/Channel.js +++ b/src/Channel.js @@ -364,8 +364,10 @@ class Channel extends EventEmitter { this.crown = new Crown(id, prsn.user._id); this.crowndropped = false; } else { - this.crown = new Crown(id, this.crown.userId); - this.crowndropped = true; + if (this.crown) { + this.crown = new Crown(id, this.crown.userId); + this.crowndropped = true; + } } this.updateCh(); @@ -449,6 +451,7 @@ class Channel extends EventEmitter { this.adminChat("pong"); break; case "!setcolor": + case "!color": if (!isAdmin) { this.adminChat("You do not have permission to use this command."); return; diff --git a/src/Message.js b/src/Message.js index 1fc99c6..ea30c6a 100644 --- a/src/Message.js +++ b/src/Message.js @@ -97,7 +97,9 @@ module.exports = (cl) => { //console.log((Date.now() - cl.channel.crown.time)) //console.log(!(cl.channel.crown.userId != cl.user._id), !((Date.now() - cl.channel.crown.time) > 15000)); - if (!(cl.channel.crown.userId == cl.user._id) && !((Date.now() - cl.channel.crown.time) > 15000)) return; + if (!cl.channel.crown && !admin) { + if (!(cl.channel.crown.userId == cl.user._id) && !((Date.now() - cl.channel.crown.time) > 15000)) return; + } if (msg.hasOwnProperty("id")) { // console.log(cl.channel.crown) @@ -369,13 +371,14 @@ module.exports = (cl) => { if (!msg.hasOwnProperty('msg')) return; if (typeof msg.msg != 'object') return; + if (typeof msg.msg.m != 'string') return; if (!cl.channel) return; if (!msg.hasOwnProperty('_id')) msg._id = cl.channel._id; let ch = cl.server.rooms.get(msg._id); if (!ch) return; - ch.emit(msg.m, msg); + ch.emit(msg.msg.m, msg.msg); }); cl.on('name', (msg, admin) => {