mirror of
https://github.com/danbulant/discord.js
synced 2026-07-06 03:31:03 +00:00
Add VoiceConnection errors (#1649)
This commit is contained in:
parent
1c901cee7b
commit
afcf43aef6
2 changed files with 8 additions and 4 deletions
|
|
@ -177,14 +177,14 @@ class VoiceConnection extends EventEmitter {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!token) {
|
if (!token) {
|
||||||
this.authenticateFailed('Token not provided from voice server packet.');
|
this.authenticateFailed('VOICE_TOKEN_ABSENT');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
endpoint = endpoint.match(/([^:]*)/)[0];
|
endpoint = endpoint.match(/([^:]*)/)[0];
|
||||||
|
|
||||||
if (!endpoint) {
|
if (!endpoint) {
|
||||||
this.authenticateFailed('Invalid endpoint received.');
|
this.authenticateFailed('VOICE_INVALID_ENDPOINT');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -203,7 +203,7 @@ class VoiceConnection extends EventEmitter {
|
||||||
*/
|
*/
|
||||||
setSessionID(sessionID) {
|
setSessionID(sessionID) {
|
||||||
if (!sessionID) {
|
if (!sessionID) {
|
||||||
this.authenticateFailed('Session ID not supplied.');
|
this.authenticateFailed('VOICE_SESSION_ABSENT');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -277,7 +277,7 @@ class VoiceConnection extends EventEmitter {
|
||||||
authenticate() {
|
authenticate() {
|
||||||
this.sendVoiceStateUpdate();
|
this.sendVoiceStateUpdate();
|
||||||
this.connectTimeout = this.client.setTimeout(
|
this.connectTimeout = this.client.setTimeout(
|
||||||
() => this.authenticateFailed(new Error('Connection not established within 15 seconds.')), 15000);
|
() => this.authenticateFailed('VOICE_CONNECTION_TIMEOUT'), 15000);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -47,6 +47,10 @@ const Messages = {
|
||||||
VOICE_STREAM_EXISTS: 'There is already an existing stream for that user.',
|
VOICE_STREAM_EXISTS: 'There is already an existing stream for that user.',
|
||||||
VOICE_JOIN_CHANNEL: (full = false) =>
|
VOICE_JOIN_CHANNEL: (full = false) =>
|
||||||
`You do not have permission to join this voice channel${full ? '; it is full.' : '.'}`,
|
`You do not have permission to join this voice channel${full ? '; it is full.' : '.'}`,
|
||||||
|
VOICE_CONNECTION_TIMEOUT: 'Connection not established within 15 seconds.',
|
||||||
|
VOICE_TOKEN_ABSENT: 'Token not provided from voice server packet.',
|
||||||
|
VOICE_SESSION_ABSENT: 'Session ID not supplied.',
|
||||||
|
VOICE_INVALID_ENDPOINT: 'Invalid endpoint received.',
|
||||||
|
|
||||||
OPUS_ENGINE_MISSING: 'Couldn\'t find an Opus engine.',
|
OPUS_ENGINE_MISSING: 'Couldn\'t find an Opus engine.',
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue