mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-11 00:53:31 +01:00
Throw errors on missing voice dependencies
This commit is contained in:
@@ -197,15 +197,13 @@ export default class VoiceConnection extends EventEmitter {
|
||||
try {
|
||||
if (!self.encoder.opus){
|
||||
self.playing=false;
|
||||
self.emit("error", "No Opus!");
|
||||
self.client.emit("debug", "Tried to use node-opus, but opus not available - install it!");
|
||||
throw new Error("node-opus not found! Perhaps you didn't install it.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!self.encoder.sanityCheck()) {
|
||||
self.playing = false;
|
||||
self.emit("error", "Opus sanity check failed!");
|
||||
self.client.emit("debug", "Opus sanity check failed - opus is installed but not correctly! Please reinstall opus and make sure it's installed correctly.");
|
||||
throw new Error("node-opus sanity check failed! Try re-installing node-opus.");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,12 +1,20 @@
|
||||
"use strict";
|
||||
|
||||
import nacl from "tweetnacl";
|
||||
var nacl;
|
||||
try {
|
||||
nacl = require("tweetnacl");
|
||||
} catch (e) {
|
||||
// no tweetnacl!
|
||||
}
|
||||
|
||||
const nonce = new Buffer(24);
|
||||
nonce.fill(0);
|
||||
|
||||
export default class VoicePacket {
|
||||
constructor(data, sequence, time, ssrc, secret){
|
||||
if(!nacl) {
|
||||
throw new Error("tweetnacl not found! Perhaps you didn't install it.");
|
||||
}
|
||||
var mac = secret ? 16 : 0;
|
||||
var packetLength = data.length + 12 + mac;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user