From be9a700209975450acd32ce846bb28af8aa76589 Mon Sep 17 00:00:00 2001 From: TTtie Date: Sun, 27 Aug 2023 18:21:32 +0000 Subject: [PATCH] feat(VoiceConnection): lower browser runtime error to a warning The base work around "browser" support was done over 7 years ago. Although nothing much has changed when it comes to supporting UDP connections in browsers, over time, browser-like runtimes like Deno, Bun, and others claiming (partial) Node compatibility (including UDP connections) have emerged. Although using Dysnomia with these browser- -like environments won't be officially supported, I think that rather than blocking them outright, we should acknowledge that those alternative runtimes exist and allow them to try to use voice at their own risk with a warning that they might possibly end up seeing undefined or weird behavior. --- lib/voice/VoiceConnection.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/voice/VoiceConnection.js b/lib/voice/VoiceConnection.js index d643600b..c34b771d 100644 --- a/lib/voice/VoiceConnection.js +++ b/lib/voice/VoiceConnection.js @@ -106,7 +106,7 @@ class VoiceConnection extends EventEmitter { super(); if(typeof window !== "undefined") { - throw new Error("Voice is not supported in browsers at this time"); + process.emitWarning("Voice is not supported in browser-like runtimes. Proceed at your own caution.", "BrowserLikeRuntimeWarning", "dysnomia:VOICE_BROWSER"); } if(!Sodium && !NaCl) {