mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-14 02:23:31 +01:00
voice: move broadcasts to client.voice
This commit is contained in:
@@ -3,10 +3,11 @@
|
||||
const Collection = require('../../util/Collection');
|
||||
const { VoiceStatus } = require('../../util/Constants');
|
||||
const VoiceConnection = require('./VoiceConnection');
|
||||
const VoiceBroadcast = require('./VoiceBroadcast');
|
||||
const { Error } = require('../../errors');
|
||||
|
||||
/**
|
||||
* Manages all the voice stuff for the client.
|
||||
* Manages voice connections for the client
|
||||
* @private
|
||||
*/
|
||||
class ClientVoiceManager {
|
||||
@@ -22,6 +23,22 @@ class ClientVoiceManager {
|
||||
* @type {Collection<Snowflake, VoiceConnection>}
|
||||
*/
|
||||
this.connections = new Collection();
|
||||
|
||||
/**
|
||||
* Active voice broadcasts that have been created
|
||||
* @type {VoiceBroadcast[]}
|
||||
*/
|
||||
this.broadcasts = [];
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a voice broadcast.
|
||||
* @returns {VoiceBroadcast}
|
||||
*/
|
||||
createVoiceBroadcast() {
|
||||
const broadcast = new VoiceBroadcast(this);
|
||||
this.broadcasts.push(broadcast);
|
||||
return broadcast;
|
||||
}
|
||||
|
||||
onVoiceServer({ guild_id, token, endpoint }) {
|
||||
@@ -46,6 +63,7 @@ class ClientVoiceManager {
|
||||
* Sets up a request to join a voice channel.
|
||||
* @param {VoiceChannel} channel The voice channel to join
|
||||
* @returns {Promise<VoiceConnection>}
|
||||
* @private
|
||||
*/
|
||||
joinChannel(channel) {
|
||||
return new Promise((resolve, reject) => {
|
||||
|
||||
Reference in New Issue
Block a user