From 44d81b6fd775a7cdc616afd185856d38ff6eb7a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christer=20War=C3=A9n?= Date: Fri, 10 Sep 2021 01:21:42 +0300 Subject: [PATCH] Add warning event --- src/Client.ts | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/Client.ts b/src/Client.ts index 2e0d282..8a89e5f 100644 --- a/src/Client.ts +++ b/src/Client.ts @@ -81,6 +81,10 @@ class RadioClient extends Client { require(`${events}voiceStateUpdate`).execute(this, oldState, newState); }); + this.on("error", error => { + console.error(error); + }); + process.on('SIGINT', () => { require(`${events}SIGINT`).execute(this); }); @@ -97,8 +101,14 @@ class RadioClient extends Client { this.funcs.logger("Bot", "Stopping"); }); - this.on("error", error => { - console.error(error); + process.on('warning', (warning) => { + if(warning.name == "ExperimentalWarning" && warning.message.startsWith("stream/web")) return; + + this.funcs.logger("Warning"); + console.warn(warning.name); + console.warn(warning.message); + console.warn(warning.stack); + console.log(''); }); this.login(this.config.token).catch(err => console.log("Failed to login: " + err));