Remove even more stuff from web dists

This commit is contained in:
Schuyler Cebulskie
2016-11-20 22:40:06 -05:00
parent 7e69475d11
commit f6a60581c4
6 changed files with 35 additions and 9 deletions

View File

@@ -83,11 +83,11 @@ class Client extends EventEmitter {
this.actions = new ActionsManager(this);
/**
* The Voice Manager of the Client
* @type {ClientVoiceManager}
* The Voice Manager of the Client (`null` in browsers)
* @type {?ClientVoiceManager}
* @private
*/
this.voice = new ClientVoiceManager(this);
this.voice = !this.browser ? new ClientVoiceManager(this) : null;
/**
* The shard helpers for the client (only if the process was spawned as a child, such as from a ShardingManager)
@@ -186,6 +186,7 @@ class Client extends EventEmitter {
* @readonly
*/
get voiceConnections() {
if (this.browser) return new Collection();
return this.voice.connections;
}

View File

@@ -78,7 +78,6 @@ class ClientVoiceManager {
*/
joinChannel(channel) {
return new Promise((resolve, reject) => {
if (this.client.browser) throw new Error('Voice connections are not available in browsers.');
if (this.pending.get(channel.guild.id)) throw new Error('Already connecting to this guild\'s voice server.');
if (!channel.joinable) throw new Error('You do not have permission to join this voice channel.');

View File

@@ -256,6 +256,7 @@ class Guild {
* @readonly
*/
get voiceConnection() {
if (this.client.browser) return null;
return this.client.voice.connections.get(this.id) || null;
}

View File

@@ -50,6 +50,7 @@ class VoiceChannel extends GuildChannel {
* @type {boolean}
*/
get joinable() {
if (this.client.browser) return false;
return this.permissionsFor(this.client.user).hasPermission('CONNECT');
}
@@ -99,6 +100,7 @@ class VoiceChannel extends GuildChannel {
* .catch(console.error);
*/
join() {
if (this.client.browser) return Promise.reject(new Error('Voice connections are not available in browsers.'));
return this.client.voice.joinChannel(this);
}
@@ -109,6 +111,7 @@ class VoiceChannel extends GuildChannel {
* voiceChannel.leave();
*/
leave() {
if (this.client.browser) return;
const connection = this.client.voice.connections.get(this.guild.id);
if (connection && connection.channel.id === this.id) connection.disconnect();
}