mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-11 09:03:29 +01:00
Properly check whether an Opus engine exists (#1150)
* Properly check whether an Opus engine exists I think I'm retarded * Fix eslint error * Update OpusEngineList.js
This commit is contained in:
committed by
Schuyler Cebulskie
parent
7ed58f5f7f
commit
78dafb9480
@@ -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.');
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user