From 72dd872fce70754b0f7616f3d31b5616a48c7188 Mon Sep 17 00:00:00 2001 From: Amish Shah Date: Sun, 12 May 2019 20:29:28 +0100 Subject: [PATCH] VoiceBroadcast.{dispatchers -> subscribers} --- src/client/voice/VoiceBroadcast.js | 16 ++++++++-------- .../voice/dispatcher/BroadcastDispatcher.js | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/client/voice/VoiceBroadcast.js b/src/client/voice/VoiceBroadcast.js index 6b5da074f..2f30f3550 100644 --- a/src/client/voice/VoiceBroadcast.js +++ b/src/client/voice/VoiceBroadcast.js @@ -28,10 +28,10 @@ class VoiceBroadcast extends EventEmitter { */ this.client = client; /** - * The dispatchers playing this broadcast + * The subscribed StreamDispatchers of this broadcast * @type {StreamDispatcher[]} */ - this.dispatchers = []; + this.subscribers = []; this.player = new BroadcastAudioPlayer(this); } @@ -66,19 +66,19 @@ class VoiceBroadcast extends EventEmitter { * Ends the broadcast, unsubscribing all subscribed channels and deleting the broadcast */ end() { - for (const dispatcher of this.dispatchers) this.delete(dispatcher); + for (const dispatcher of this.subscribers) this.delete(dispatcher); const index = this.client.voice.broadcasts.indexOf(this); if (index !== -1) this.client.voice.broadcasts.splice(index, 1); } add(dispatcher) { - const index = this.dispatchers.indexOf(dispatcher); + const index = this.subscribers.indexOf(dispatcher); if (index === -1) { - this.dispatchers.push(dispatcher); + this.subscribers.push(dispatcher); /** * Emitted whenever a stream dispatcher subscribes to the broadcast. * @event VoiceBroadcast#subscribe - * @param {StreamDispatcher} dispatcher The subscribed dispatcher + * @param {StreamDispatcher} subscriber The subscribed dispatcher */ this.emit(Events.VOICE_BROADCAST_SUBSCRIBE, dispatcher); return true; @@ -88,9 +88,9 @@ class VoiceBroadcast extends EventEmitter { } delete(dispatcher) { - const index = this.dispatchers.indexOf(dispatcher); + const index = this.subscribers.indexOf(dispatcher); if (index !== -1) { - this.dispatchers.splice(index, 1); + this.subscribers.splice(index, 1); dispatcher.destroy(); /** * Emitted whenever a stream dispatcher unsubscribes to the broadcast. diff --git a/src/client/voice/dispatcher/BroadcastDispatcher.js b/src/client/voice/dispatcher/BroadcastDispatcher.js index d7fd8dfaf..ae8d412ed 100644 --- a/src/client/voice/dispatcher/BroadcastDispatcher.js +++ b/src/client/voice/dispatcher/BroadcastDispatcher.js @@ -15,7 +15,7 @@ class BroadcastDispatcher extends StreamDispatcher { _write(chunk, enc, done) { if (!this.startTime) this.startTime = Date.now(); - for (const dispatcher of this.broadcast.dispatchers) { + for (const dispatcher of this.broadcast.subscribers) { dispatcher._write(chunk, enc); } this._step(done);