diff --git a/ClusterManager.js b/ClusterManager.js index 68bacf5..c0ed526 100644 --- a/ClusterManager.js +++ b/ClusterManager.js @@ -28,7 +28,7 @@ class ClusterManager extends EventEmitter { totalShards: 'auto', shardArgs: [], execArgv: [], - mode: 'worker', + mode: 'process', shardList: 'auto', token: process.env.DISCORD_TOKEN, }, @@ -80,7 +80,7 @@ class ClusterManager extends EventEmitter { */ this.mode = options.mode; if (this.mode !== 'worker' && this.mode !== "process") { - throw new RangeError('CLIENT_INVALID_OPTION', 'Cluster mode', '"worker"'); + throw new RangeError('CLIENT_INVALID_OPTION', 'Cluster mode', '"worker/process"'); } /** @@ -148,6 +148,7 @@ class ClusterManager extends EventEmitter { async spawn(amount = this.totalShards, delay = 5500, spawnTimeout) { if (amount === 'auto') { amount = await Discord.fetchRecommendedShards(this.token, 1000); + this.totalShards = amount; } else { if (typeof amount !== 'number' || isNaN(amount)) { throw new TypeError('CLIENT_INVALID_OPTION', 'Amount of internal shards', 'a number.'); @@ -174,7 +175,7 @@ class ClusterManager extends EventEmitter { if(this.shardList === "auto") this.shardList = [...Array(amount).keys()]; this.shardclusterlist = this.shardList.chunk(Math.ceil(this.shardList.length/this.totalClusters)); if(this.shardclusterlist.length !== this.totalClusters){ - this.totalClusters = this.shardclusterlist.length; + this.totalClusters = this.shardclusterlist.length ; } if (this.shardList.some(shardID => shardID >= amount)) { throw new RangeError( diff --git a/package.json b/package.json index a1010d8..f0279a8 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "discord-hybrid-sharding", - "version": "1.0.7", + "version": "1.0.8", "description": "The first package which combines Sharding Manager & Internal Sharding to save a lot of ressources", "main": "index.js", "types": "./typings.d.ts",