Revert "Attempted better join/leave msgs"

This reverts commit 4a079da5c6.
This commit is contained in:
ledlamp 2018-05-31 13:55:32 -07:00
parent 4a079da5c6
commit 5ec1bff6e9
1 changed files with 27 additions and 37 deletions

View File

@ -92,21 +92,14 @@ global.createMPPbridge = function (room, DiscordChannelID, site = 'MPP', webhook
console.log(`[${site}] [${room}] ${status}`);
});*/
let lastCh = {_id:room};
gClient.on('ch', async msg => {
// on room change
if (msg.ch._id !== lastCh._id) {
dSend(`**Channel changed from \`${lastCh._id}\` to \`${msg.ch._id}\`**`);
console.log(`[${site}][${room}] Channel changed from ${lastCh._id} to ${msg.ch._id}`);
let lastCh = room;
gClient.on('ch', msg => {
if (lastCh && msg.ch._id !== lastCh) {
dSend(`**Channel changed from \`${lastCh}\` to \`${msg.ch._id}\`**`);
console.log(`[${site}][${room}] Channel changed from ${lastCh} to ${msg.ch._id}`);
lastCh = msg.ch._id;
}
// join/leave messages
if (!msg.ch.p) {
for (let lp of lastCh.ppl) {
// thoncc
}
}
(async function(){
// catch dropped crown
if (msg.ch.crown && !msg.ch.crown.hasOwnProperty('participantId')) {
gClient.sendArray([{m:'chown', id: gClient.getOwnParticipant().id}]); // if possible
@ -114,7 +107,6 @@ global.createMPPbridge = function (room, DiscordChannelID, site = 'MPP', webhook
var ms = avail_time - Date.now();
setTimeout(()=> gClient.sendArray([{m:'chown', id: gClient.getOwnParticipant().id}]) , ms);
}
// transfer crown to owner
if (msg.ppl && msg.ch.crown && msg.ch.crown.participantId == gClient.getOwnParticipant().id) {
var res = await dbClient.query("SELECT owner_mpp__id FROM bridges WHERE mpp_room = $1 AND site = $2;", [room, site]);
@ -128,9 +120,7 @@ global.createMPPbridge = function (room, DiscordChannelID, site = 'MPP', webhook
} else return false;
});
}
lastCh = msg.ch;
})();
});
// MPP to Discord