Add VoiceChannel#full and improve joinable/join permission checks (#1100)

* Improve voice channel join permission checks

* Update ClientVoiceManager.js
This commit is contained in:
Programmix
2017-01-14 20:32:17 -08:00
committed by Schuyler Cebulskie
parent 7cb5b22ebb
commit d10ca8e7ba
2 changed files with 18 additions and 2 deletions

View File

@@ -45,13 +45,23 @@ class VoiceChannel extends GuildChannel {
return null;
}
/**
* Checks if the voice channel is full
* @type {boolean}
*/
get full() {
return this.members.size >= this.userLimit;
}
/**
* Checks if the client has permission join the voice channel
* @type {boolean}
*/
get joinable() {
if (this.client.browser) return false;
return this.permissionsFor(this.client.user).hasPermission('CONNECT');
if (!this.permissionsFor(this.client.user).hasPermission('CONNECT')) return false;
if (this.full && !this.permissionsFor(this.client.user).hasPermission('MOVE_MEMBERS')) return false;
return true;
}
/**