mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-12 01:23:31 +01:00
Improve docs a bit
This commit is contained in:
@@ -65,8 +65,8 @@ class Shard {
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetches a Client property value of the shard.
|
||||
* @param {string} prop Name of the Client property to get, using periods for nesting
|
||||
* Fetches a client property value of the shard.
|
||||
* @param {string} prop Name of the client property to get, using periods for nesting
|
||||
* @returns {Promise<*>}
|
||||
* @example
|
||||
* shard.fetchClientValue('guilds.size').then(count => {
|
||||
@@ -97,7 +97,7 @@ class Shard {
|
||||
}
|
||||
|
||||
/**
|
||||
* Evaluates a script on the shard, in the context of the Client.
|
||||
* Evaluates a script on the shard, in the context of the client.
|
||||
* @param {string} script JavaScript to run on the shard
|
||||
* @returns {Promise<*>} Result of the script execution
|
||||
*/
|
||||
@@ -125,7 +125,7 @@ class Shard {
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles an IPC message
|
||||
* Handles an IPC message.
|
||||
* @param {*} message Message received
|
||||
* @private
|
||||
*/
|
||||
@@ -151,7 +151,7 @@ class Shard {
|
||||
}
|
||||
|
||||
/**
|
||||
* Emitted upon recieving a message from a shard
|
||||
* Emitted upon recieving a message from a shard.
|
||||
* @event ShardingManager#message
|
||||
* @param {Shard} shard Shard that sent the message
|
||||
* @param {*} message Message that was received
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
const Util = require('../util/Util');
|
||||
|
||||
/**
|
||||
* Helper class for sharded clients spawned as a child process, such as from a ShardingManager
|
||||
* Helper class for sharded clients spawned as a child process, such as from a ShardingManager.
|
||||
*/
|
||||
class ShardClientUtil {
|
||||
/**
|
||||
* @param {Client} client Client of the current shard
|
||||
* @param {Client} client The client of the current shard
|
||||
*/
|
||||
constructor(client) {
|
||||
this.client = client;
|
||||
@@ -31,7 +31,7 @@ class ShardClientUtil {
|
||||
}
|
||||
|
||||
/**
|
||||
* Sends a message to the master process
|
||||
* Sends a message to the master process.
|
||||
* @param {*} message Message to send
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
@@ -45,8 +45,8 @@ class ShardClientUtil {
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetches a Client property value of each shard.
|
||||
* @param {string} prop Name of the Client property to get, using periods for nesting
|
||||
* Fetches a client property value of each shard.
|
||||
* @param {string} prop Name of the client property to get, using periods for nesting
|
||||
* @returns {Promise<Array>}
|
||||
* @example
|
||||
* client.shard.fetchClientValues('guilds.size').then(results => {
|
||||
@@ -91,7 +91,7 @@ class ShardClientUtil {
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles an IPC message
|
||||
* Handles an IPC message.
|
||||
* @param {*} message Message received
|
||||
* @private
|
||||
*/
|
||||
@@ -112,7 +112,7 @@ class ShardClientUtil {
|
||||
}
|
||||
|
||||
/**
|
||||
* Sends a message to the master process, emitting an error from the client upon failure
|
||||
* Sends a message to the master process, emitting an error from the client upon failure.
|
||||
* @param {string} type Type of response to send
|
||||
* @param {*} message Message to send
|
||||
* @private
|
||||
@@ -125,8 +125,8 @@ class ShardClientUtil {
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates/gets the singleton of this class
|
||||
* @param {Client} client Client to use
|
||||
* Creates/gets the singleton of this class.
|
||||
* @param {Client} client The client to use
|
||||
* @returns {ShardClientUtil}
|
||||
*/
|
||||
static singleton(client) {
|
||||
|
||||
@@ -6,7 +6,7 @@ const Collection = require('../util/Collection');
|
||||
const Util = require('../util/Util');
|
||||
|
||||
/**
|
||||
* This is a utility class that can be used to help you spawn shards of your Client. Each shard is completely separate
|
||||
* This is a utility class that can be used to help you spawn shards of your client. Each shard is completely separate
|
||||
* from the other. The Shard Manager takes a path to a file and spawns it under the specified amount of shards safely.
|
||||
* If you do not select an amount of shards, the manager will automatically decide the best amount.
|
||||
* @extends {EventEmitter}
|
||||
@@ -61,7 +61,7 @@ class ShardingManager extends EventEmitter {
|
||||
this.respawn = options.respawn;
|
||||
|
||||
/**
|
||||
* An array of arguments to pass to shards.
|
||||
* An array of arguments to pass to shards
|
||||
* @type {string[]}
|
||||
*/
|
||||
this.shardArgs = options.shardArgs;
|
||||
@@ -81,14 +81,14 @@ class ShardingManager extends EventEmitter {
|
||||
|
||||
/**
|
||||
* Spawns a single shard.
|
||||
* @param {number} id The ID of the shard to spawn. **This is usually not necessary.**
|
||||
* @param {number} id The ID of the shard to spawn. **This is usually not necessary**
|
||||
* @returns {Promise<Shard>}
|
||||
*/
|
||||
createShard(id = this.shards.size) {
|
||||
const shard = new Shard(this, id, this.shardArgs);
|
||||
this.shards.set(id, shard);
|
||||
/**
|
||||
* Emitted upon launching a shard
|
||||
* Emitted upon launching a shard.
|
||||
* @event ShardingManager#launch
|
||||
* @param {Shard} shard Shard that was launched
|
||||
*/
|
||||
@@ -172,8 +172,8 @@ class ShardingManager extends EventEmitter {
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetches a Client property value of each shard.
|
||||
* @param {string} prop Name of the Client property to get, using periods for nesting
|
||||
* Fetches a client property value of each shard.
|
||||
* @param {string} prop Name of the client property to get, using periods for nesting
|
||||
* @returns {Promise<Array>}
|
||||
* @example
|
||||
* manager.fetchClientValues('guilds.size').then(results => {
|
||||
|
||||
Reference in New Issue
Block a user