From 748f0232d8f8dc4b47aaa9c4a26ab636901c2021 Mon Sep 17 00:00:00 2001 From: Lamp Date: Thu, 29 Nov 2018 12:37:29 -0800 Subject: [PATCH] =?UTF-8?q?don't=20repeat=20errors=E2=80=A6=20=F0=9F=A4=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/mppbridger/index.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/mppbridger/index.js b/src/mppbridger/index.js index a3e640e..03877ef 100755 --- a/src/mppbridger/index.js +++ b/src/mppbridger/index.js @@ -54,10 +54,14 @@ global.createMPPbridge = function createMPPbridge(room, DiscordChannelID, site = gClient.setChannel(room); }, 1000); - + let lastError; gClient.on("error", error => { console.error(`[${site}][${room}]`, error.message); - dSend(`**${error.message}**`); + error = error.toString(); + if (lastError != error) { + dSend(`**${error.toString()}**`); + lastError = error; + } }); var isConnected = false; // TODO use gClient.isConnected() ? gClient.on('connect', () => {