voice: add end param to describe how a voice receive stream should end

This commit is contained in:
Amish Shah
2018-03-31 11:52:48 +01:00
parent 623d4c0076
commit a5e8f05d01
3 changed files with 25 additions and 7 deletions

View File

@@ -423,7 +423,14 @@ class VoiceConnection extends EventEmitter {
* @param {User} user The user that has started/stopped speaking
* @param {boolean} speaking Whether or not the user is speaking
*/
if (this.status === VoiceStatus.CONNECTED) this.emit('speaking', user, speaking);
if (this.status === VoiceStatus.CONNECTED) {
this.emit('speaking', user, speaking);
if (!speaking) {
for (const receiver of this.receivers) {
receiver.packets._stoppedSpeaking(user_id);
}
}
}
guild._memberSpeakUpdate(user_id, speaking);
}