From be0d1cd6637bca837f687bfd00e07e8bacf52838 Mon Sep 17 00:00:00 2001 From: Lewdcario Date: Sun, 4 Nov 2018 23:25:54 -0600 Subject: [PATCH] fix: Client#shards not being set properly --- src/client/Client.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/client/Client.js b/src/client/Client.js index 339e55646..5d5deddf6 100644 --- a/src/client/Client.js +++ b/src/client/Client.js @@ -53,6 +53,10 @@ class Client extends BaseClient { this.options.totalShardCount = this.options.shardCount; } } + if (!this.options.shards && this.options.shardCount) { + this.options.shards = []; + for (let i = 0; i < this.options.shardCount; ++i) this.options.shards.push(i); + } this._validateOptions(); @@ -227,6 +231,10 @@ class Client extends BaseClient { this.emit(Events.DEBUG, `Using recommended shard count ${res.shards}`); this.options.shardCount = res.shards; this.options.totalShardCount = res.shards; + if (!this.options.shards || !this.options.shards.length) { + this.options.shards = []; + for (let i = 0; i < this.options.shardCount; ++i) this.options.shards.push(i); + } } this.emit(Events.DEBUG, `Using gateway ${gateway}`); this.ws.connect(gateway);