mirror of
https://github.com/danbulant/discord.js
synced 2026-05-25 21:12:06 +00: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:
parent
7ed58f5f7f
commit
78dafb9480
1 changed files with 4 additions and 1 deletions
|
|
@ -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.');
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in a new issue