From a1aa5f015477a52f73a04874bd855f60cff21074 Mon Sep 17 00:00:00 2001 From: Lamp Date: Fri, 14 Dec 2018 06:07:35 +0000 Subject: [PATCH] _events[name].unshift() not compatible with nodejs EventEmitter; use .prependListener() --- src/mppbridger/index.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/mppbridger/index.js b/src/mppbridger/index.js index 71b9d3e..aa38506 100755 --- a/src/mppbridger/index.js +++ b/src/mppbridger/index.js @@ -180,9 +180,7 @@ global.createMPPbridge = function createMPPbridge(room, DiscordChannelID, site = // announce join/leave/rename - gClient._events.p = gClient._events.p || []; - gClient._events.bye = gClient._events.bye || []; - gClient._events.p.unshift(async participant => { + gClient.prependListener("p", async participant => { if (gClient.ppl[participant.id]) { // is update let oldName = gClient.ppl[participant.id].name, newName = participant.name; if (newName != oldName) @@ -191,7 +189,7 @@ global.createMPPbridge = function createMPPbridge(room, DiscordChannelID, site = dSend(`\`${participant._id.substr(0,6)}\` ___**${sanitizeName(participant.name)}** entered the room.___`); } }); - gClient._events.bye.unshift(async msg => { + gClient.prependListener("bye", async msg => { var participant = MPP.client.ppl[msg.p]; dSend(`\`${participant._id.substr(0,6)}\` ___**${sanitizeName(participant.name)}** left the room.___`); });