refactor: new node features (#5132)

Co-authored-by: Antonio Román <kyradiscord@gmail.com>
This commit is contained in:
Sugden
2021-06-30 21:40:33 +01:00
committed by GitHub
parent f108746c15
commit 1e8f01253e
68 changed files with 305 additions and 360 deletions

View File

@@ -70,7 +70,7 @@ class ShardingManager extends EventEmitter {
* List of shards this sharding manager spawns
* @type {string|number[]}
*/
this.shardList = options.shardList || 'auto';
this.shardList = options.shardList ?? 'auto';
if (this.shardList !== 'auto') {
if (!Array.isArray(this.shardList)) {
throw new TypeError('CLIENT_INVALID_OPTION', 'shardList', 'an array.');
@@ -132,7 +132,7 @@ class ShardingManager extends EventEmitter {
* Token to use for obtaining the automatic shard count, and passing to shards
* @type {?string}
*/
this.token = options.token ? options.token.replace(/^Bot\s*/i, '') : null;
this.token = options.token?.replace(/^Bot\s*/i, '') ?? null;
/**
* A collection of shards that this manager has spawned