fix issue causing chat from other clients of same user in same room not getting through most of the time

bot was constantly sending chat every 1.6 seconds even when queue is empty herp derp
This commit is contained in:
Lamp 2020-04-06 22:43:46 -07:00 committed by GitHub
parent f2185a0887
commit 00bea9d9ab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 1 deletions

View File

@ -171,7 +171,8 @@ global.createMPPbridge = function createMPPbridge(room, DiscordChannelID, site =
msgQueue.push(str);
});
setInterval(()=>{
gClient.sendArray([{m:'a', message: msgQueue.shift()}]);
let message = msgQueue.shift();
if (message) gClient.sendArray([{m:'a', message}]);
}, 1600); // just about fastest without exceeding quota; I figured quota is 4 messages per 6 seconds in lobbies
}