diff --git a/src/client/voice/opus/OpusEngineList.js b/src/client/voice/opus/OpusEngineList.js index bc9fe6102..2aa7f17fc 100644 --- a/src/client/voice/opus/OpusEngineList.js +++ b/src/client/voice/opus/OpusEngineList.js @@ -3,6 +3,8 @@ const list = [ require('./OpusScriptEngine'), ]; +let opusEngineFound; + function fetch(Encoder) { try { return new Encoder(); @@ -24,5 +26,6 @@ exports.fetch = () => { }; exports.guaranteeOpusEngine = () => { - if (!this.opusEncoder) throw new Error('Couldn\'t find an Opus engine.'); + if (typeof opusEngineFound === 'undefined') opusEngineFound = Boolean(exports.fetch()); + if (!opusEngineFound) throw new Error('Couldn\'t find an Opus engine.'); };