mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-13 18:13:29 +01:00
refactor: change xID to xId (#6036)
* refactor: change `xID` to `xId` * Update src/managers/MessageManager.js Co-authored-by: Noel <buechler.noel@outlook.com> Co-authored-by: Noel <buechler.noel@outlook.com>
This commit is contained in:
@@ -76,10 +76,10 @@ class ShardingManager extends EventEmitter {
|
||||
throw new TypeError('CLIENT_INVALID_OPTION', 'shardList', 'an array.');
|
||||
}
|
||||
this.shardList = [...new Set(this.shardList)];
|
||||
if (this.shardList.length < 1) throw new RangeError('CLIENT_INVALID_OPTION', 'shardList', 'at least 1 ID.');
|
||||
if (this.shardList.length < 1) throw new RangeError('CLIENT_INVALID_OPTION', 'shardList', 'at least 1 id.');
|
||||
if (
|
||||
this.shardList.some(
|
||||
shardID => typeof shardID !== 'number' || isNaN(shardID) || !Number.isInteger(shardID) || shardID < 0,
|
||||
shardId => typeof shardId !== 'number' || isNaN(shardId) || !Number.isInteger(shardId) || shardId < 0,
|
||||
)
|
||||
) {
|
||||
throw new TypeError('CLIENT_INVALID_OPTION', 'shardList', 'an array of positive integers.');
|
||||
@@ -148,7 +148,7 @@ class ShardingManager extends EventEmitter {
|
||||
/**
|
||||
* Creates a single shard.
|
||||
* <warn>Using this method is usually not necessary if you use the spawn method.</warn>
|
||||
* @param {number} [id=this.shards.size] ID of the shard to create
|
||||
* @param {number} [id=this.shards.size] Id of the shard to create
|
||||
* <info>This is usually not necessary to manually specify.</info>
|
||||
* @returns {Shard} Note that the created shard needs to be explicitly spawned using its spawn method.
|
||||
*/
|
||||
@@ -200,18 +200,18 @@ class ShardingManager extends EventEmitter {
|
||||
this.totalShards = amount;
|
||||
}
|
||||
|
||||
if (this.shardList.some(shardID => shardID >= amount)) {
|
||||
if (this.shardList.some(shardId => shardId >= amount)) {
|
||||
throw new RangeError(
|
||||
'CLIENT_INVALID_OPTION',
|
||||
'Amount of shards',
|
||||
'bigger than the highest shardID in the shardList option.',
|
||||
'bigger than the highest shardId in the shardList option.',
|
||||
);
|
||||
}
|
||||
|
||||
// Spawn the shards
|
||||
for (const shardID of this.shardList) {
|
||||
for (const shardId of this.shardList) {
|
||||
const promises = [];
|
||||
const shard = this.createShard(shardID);
|
||||
const shard = this.createShard(shardId);
|
||||
promises.push(shard.spawn(timeout));
|
||||
if (delay > 0 && this.shards.size !== this.shardList.length) promises.push(Util.delayFor(delay));
|
||||
await Promise.all(promises); // eslint-disable-line no-await-in-loop
|
||||
|
||||
Reference in New Issue
Block a user