From da5c0bfd16cf15be11875ce475a4221a1fedd04f Mon Sep 17 00:00:00 2001 From: Lamp Date: Wed, 28 Nov 2018 15:13:10 -0800 Subject: [PATCH] show ws errors in discord --- src/mppbridger/index.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/mppbridger/index.js b/src/mppbridger/index.js index 145b598..35ed52d 100755 --- a/src/mppbridger/index.js +++ b/src/mppbridger/index.js @@ -36,14 +36,13 @@ global.createMPPbridge = function createMPPbridge(room, DiscordChannelID, site = const gClient = - site == "MPP" ? new Client((site == "MPP" && room == "lobby") ? "ws://mc.terrium.net:28886/?target=ws://www.multiplayerpiano.com:443&origin=http://www.multiplayerpiano.com" : "ws://mpp-proxy-server-mpp-proxy-server.7e14.starter-us-west-2.openshiftapps.com/") : + site == "MPP" ? new Client((site == "MPP" && room == "lobby") ? "ws://mc.terrium.net:28886/?target=ws://www.multiplayerpiano.com:443&origin=http://www.multiplayerpiano.com" : "ws://www.multiplayerpiano.com:443") : site == "WOPP" ? new Client("ws://ourworldofpixels.com:1234") : site == "MPT" ? new Client("wss://ts.terrium.net:8443") : site == "VFDP" ? new Client("ws://www.visualfiredev.com:8080") : site == "CMPC" ? new Client("ws://charsy.meowbin.com:16562") : undefined; if (!gClient) return console.error(`Invalid site ${site}`); - gClient.on("error", error => console.error(`[${site}][${room}]`, error.message)) gClient.setChannel(/*(site == "MPP" && room == "lobby") ? "lolwutsecretlobbybackdoor" : */room); gClient.start(); @@ -56,6 +55,10 @@ global.createMPPbridge = function createMPPbridge(room, DiscordChannelID, site = }, 1000); + gClient.on("error", error => { + console.error(`[${site}][${room}]`, error.message); + dSend(`**${error.message}**`); + }); var isConnected = false; // TODO use gClient.isConnected() ? gClient.on('connect', () => { console.log(`[${site}][${room}] Connected to server`);