From 8230255c68b94d68a4e8ffc559a98d08d1a08a7c Mon Sep 17 00:00:00 2001 From: Isabella Date: Tue, 15 Jan 2019 01:45:29 -0600 Subject: [PATCH] fix(ShardClientUtil#id): erroneously reporting as an array --- src/client/Client.js | 4 ++-- src/util/Constants.js | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/client/Client.js b/src/client/Client.js index 1bc8232b8..4e5f5e247 100644 --- a/src/client/Client.js +++ b/src/client/Client.js @@ -55,7 +55,7 @@ class Client extends BaseClient { this.options.totalShardCount = this.options.shardCount; } } - if (!this.options.shards && this.options.shardCount) { + if (typeof this.options.shards === 'undefined' && this.options.shardCount) { this.options.shards = []; for (let i = 0; i < this.options.shardCount; ++i) this.options.shards.push(i); } @@ -233,7 +233,7 @@ 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) { + if (typeof this.options.shards === 'undefined' || !this.options.shards.length) { this.options.shards = []; for (let i = 0; i < this.options.shardCount; ++i) this.options.shards.push(i); } diff --git a/src/util/Constants.js b/src/util/Constants.js index aac3f5b34..508b5f97d 100644 --- a/src/util/Constants.js +++ b/src/util/Constants.js @@ -7,7 +7,7 @@ const browser = exports.browser = typeof window !== 'undefined'; /** * Options for a client. * @typedef {Object} ClientOptions - * @property {number|number[]} [shards=0] ID of the shard to run, or an array of shard IDs + * @property {number|number[]} [shards] ID of the shard to run, or an array of shard IDs * @property {number} [shardCount=1] Total number of shards that will be spawned by this Client * @property {number} [totalShardCount=1] The total amount of shards used by all processes of this bot * (e.g. recommended shard count, shard count of the ShardingManager) @@ -37,7 +37,6 @@ const browser = exports.browser = typeof window !== 'undefined'; * @property {HTTPOptions} [http] HTTP options */ exports.DefaultOptions = { - shards: 0, shardCount: 1, totalShardCount: 1, messageCacheMaxSize: 200,