mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-18 04:23:31 +01:00
Remove even more stuff from web dists
This commit is contained in:
23
package.json
23
package.json
@@ -50,5 +50,28 @@
|
|||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=6.0.0"
|
"node": ">=6.0.0"
|
||||||
|
},
|
||||||
|
"browser": {
|
||||||
|
"src/sharding/Shard.js": false,
|
||||||
|
"src/sharding/ShardClientUtil.js": false,
|
||||||
|
"src/sharding/ShardingManager.js": false,
|
||||||
|
"src/client/voice/dispatcher/StreamDispatcher.js": false,
|
||||||
|
"src/client/voice/opus/BaseOpusEngine.js": false,
|
||||||
|
"src/client/voice/opus/NodeOpusEngine.js": false,
|
||||||
|
"src/client/voice/opus/OpusEngineList.js": false,
|
||||||
|
"src/client/voice/opus/OpusScriptEngine.js": false,
|
||||||
|
"src/client/voice/pcm/ConverterEngine.js": false,
|
||||||
|
"src/client/voice/pcm/ConverterEngineList.js": false,
|
||||||
|
"src/client/voice/pcm/FfmpegConverterEngine.js": false,
|
||||||
|
"src/client/voice/player/AudioPlayer.js": false,
|
||||||
|
"src/client/voice/player/BasePlayer.js": false,
|
||||||
|
"src/client/voice/player/DefaultPlayer.js": false,
|
||||||
|
"src/client/voice/receiver/VoiceReadable.js": false,
|
||||||
|
"src/client/voice/receiver/VoiceReceiver.js": false,
|
||||||
|
"src/client/voice/util/SecretKey.js": false,
|
||||||
|
"src/client/voice/ClientVoiceManager.js": false,
|
||||||
|
"src/client/voice/VoiceConnection.js": false,
|
||||||
|
"src/client/voice/VoiceUDPClient.js": false,
|
||||||
|
"src/client/voice/VoiceWebSocket.js": false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -83,11 +83,11 @@ class Client extends EventEmitter {
|
|||||||
this.actions = new ActionsManager(this);
|
this.actions = new ActionsManager(this);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Voice Manager of the Client
|
* The Voice Manager of the Client (`null` in browsers)
|
||||||
* @type {ClientVoiceManager}
|
* @type {?ClientVoiceManager}
|
||||||
* @private
|
* @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)
|
* 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
|
* @readonly
|
||||||
*/
|
*/
|
||||||
get voiceConnections() {
|
get voiceConnections() {
|
||||||
|
if (this.browser) return new Collection();
|
||||||
return this.voice.connections;
|
return this.voice.connections;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -78,7 +78,6 @@ class ClientVoiceManager {
|
|||||||
*/
|
*/
|
||||||
joinChannel(channel) {
|
joinChannel(channel) {
|
||||||
return new Promise((resolve, reject) => {
|
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 (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.');
|
if (!channel.joinable) throw new Error('You do not have permission to join this voice channel.');
|
||||||
|
|
||||||
|
|||||||
@@ -256,6 +256,7 @@ class Guild {
|
|||||||
* @readonly
|
* @readonly
|
||||||
*/
|
*/
|
||||||
get voiceConnection() {
|
get voiceConnection() {
|
||||||
|
if (this.client.browser) return null;
|
||||||
return this.client.voice.connections.get(this.id) || null;
|
return this.client.voice.connections.get(this.id) || null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -50,6 +50,7 @@ class VoiceChannel extends GuildChannel {
|
|||||||
* @type {boolean}
|
* @type {boolean}
|
||||||
*/
|
*/
|
||||||
get joinable() {
|
get joinable() {
|
||||||
|
if (this.client.browser) return false;
|
||||||
return this.permissionsFor(this.client.user).hasPermission('CONNECT');
|
return this.permissionsFor(this.client.user).hasPermission('CONNECT');
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -99,6 +100,7 @@ class VoiceChannel extends GuildChannel {
|
|||||||
* .catch(console.error);
|
* .catch(console.error);
|
||||||
*/
|
*/
|
||||||
join() {
|
join() {
|
||||||
|
if (this.client.browser) return Promise.reject(new Error('Voice connections are not available in browsers.'));
|
||||||
return this.client.voice.joinChannel(this);
|
return this.client.voice.joinChannel(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -109,6 +111,7 @@ class VoiceChannel extends GuildChannel {
|
|||||||
* voiceChannel.leave();
|
* voiceChannel.leave();
|
||||||
*/
|
*/
|
||||||
leave() {
|
leave() {
|
||||||
|
if (this.client.browser) return;
|
||||||
const connection = this.client.voice.connections.get(this.guild.id);
|
const connection = this.client.voice.connections.get(this.guild.id);
|
||||||
if (connection && connection.channel.id === this.id) connection.disconnect();
|
if (connection && connection.channel.id === this.id) connection.disconnect();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,9 +22,6 @@ const createConfig = (options) => {
|
|||||||
path: __dirname,
|
path: __dirname,
|
||||||
filename,
|
filename,
|
||||||
},
|
},
|
||||||
resolve: {
|
|
||||||
descriptionFiles: ['package.json'],
|
|
||||||
},
|
|
||||||
module: {
|
module: {
|
||||||
rules: [
|
rules: [
|
||||||
{ test: /\.json$/, loader: 'json-loader' },
|
{ test: /\.json$/, loader: 'json-loader' },
|
||||||
@@ -32,9 +29,10 @@ const createConfig = (options) => {
|
|||||||
],
|
],
|
||||||
},
|
},
|
||||||
externals: {
|
externals: {
|
||||||
'node-opus': { commonjs: 'node-opus' },
|
|
||||||
opusscript: { commonjs: 'opusscript' },
|
|
||||||
ws: { commonjs: 'ws' },
|
ws: { commonjs: 'ws' },
|
||||||
|
opusscript: { commonjs: 'opusscript' },
|
||||||
|
'node-opus': { commonjs: 'node-opus' },
|
||||||
|
'tweet-nacl': { commonjs: 'tweet-nacl' },
|
||||||
},
|
},
|
||||||
node: {
|
node: {
|
||||||
fs: 'empty',
|
fs: 'empty',
|
||||||
@@ -42,6 +40,7 @@ const createConfig = (options) => {
|
|||||||
tls: 'mock',
|
tls: 'mock',
|
||||||
child_process: 'empty',
|
child_process: 'empty',
|
||||||
dgram: 'empty',
|
dgram: 'empty',
|
||||||
|
zlib: 'empty',
|
||||||
__dirname: true,
|
__dirname: true,
|
||||||
},
|
},
|
||||||
plugins,
|
plugins,
|
||||||
|
|||||||
Reference in New Issue
Block a user