mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-14 10:33:30 +01:00
Complete voice connection
This commit is contained in:
@@ -1,17 +1,23 @@
|
||||
const VoiceConnectionWebSocket = require('./VoiceConnectionWebSocket');
|
||||
const VoiceConnectionUDPClient = require('./VoiceConnectionUDPClient');
|
||||
const EventEmitter = require('events').EventEmitter;
|
||||
|
||||
class VoiceConnection extends EventEmitter {
|
||||
constructor(manager, serverID, token, sessionID, endpoint) {
|
||||
super();
|
||||
this.manager = manager;
|
||||
this.endpoint = endpoint;
|
||||
this.websocket = new VoiceConnectionWebSocket(this, serverID, token, sessionID, endpoint);
|
||||
this.ready = false;
|
||||
this.bindListeners();
|
||||
}
|
||||
|
||||
bindListeners() {
|
||||
this.websocket.on('ready-for-udp', data => {
|
||||
console.log(data);
|
||||
this.udp = new VoiceConnectionUDPClient(this, data);
|
||||
});
|
||||
this.websocket.on('ready', () => {
|
||||
this.ready = true;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user