mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-11 09:03:29 +01:00
Improve docs a bit
This commit is contained in:
@@ -8,7 +8,7 @@ class Collection extends Map {
|
||||
super(iterable);
|
||||
|
||||
/**
|
||||
* Cached array for the `array()` method - will be reset to `null` whenever `set()` or `delete()` are called.
|
||||
* Cached array for the `array()` method - will be reset to `null` whenever `set()` or `delete()` are called
|
||||
* @name Collection#_array
|
||||
* @type {?Array}
|
||||
* @private
|
||||
@@ -16,7 +16,7 @@ class Collection extends Map {
|
||||
Object.defineProperty(this, '_array', { value: null, writable: true, configurable: true });
|
||||
|
||||
/**
|
||||
* Cached array for the `keyArray()` method - will be reset to `null` whenever `set()` or `delete()` are called.
|
||||
* Cached array for the `keyArray()` method - will be reset to `null` whenever `set()` or `delete()` are called
|
||||
* @name Collection#_keyArray
|
||||
* @type {?Array}
|
||||
* @private
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
exports.Package = require('../../package.json');
|
||||
|
||||
/**
|
||||
* Options for a Client.
|
||||
* Options for a client.
|
||||
* @typedef {Object} ClientOptions
|
||||
* @property {string} [apiRequestMethod='sequential'] One of `sequential` or `burst`. The sequential handler executes
|
||||
* all requests in the order they are triggered, whereas the burst handler runs multiple in parallel, and doesn't
|
||||
@@ -28,7 +28,7 @@ exports.Package = require('../../package.json');
|
||||
* processed, potentially resulting in performance improvements for larger bots. Only disable events you are
|
||||
* 100% certain you don't need, as many are important, but not obviously so. The safest one to disable with the
|
||||
* most impact is typically `TYPING_START`.
|
||||
* @property {WebsocketOptions} [ws] Options for the websocket
|
||||
* @property {WebsocketOptions} [ws] Options for the WebSocket
|
||||
*/
|
||||
exports.DefaultOptions = {
|
||||
apiRequestMethod: 'sequential',
|
||||
@@ -45,7 +45,7 @@ exports.DefaultOptions = {
|
||||
restTimeOffset: 500,
|
||||
|
||||
/**
|
||||
* Websocket options (these are left as snake_case to match the API)
|
||||
* WebSocket options (these are left as snake_case to match the API)
|
||||
* @typedef {Object} WebsocketOptions
|
||||
* @property {number} [large_threshold=250] Number of members in a guild to be considered large
|
||||
* @property {boolean} [compress=true] Whether to compress data sent on the connection
|
||||
@@ -436,7 +436,7 @@ exports.ExplicitContentFilterTypes = [
|
||||
|
||||
exports.UserSettingsMap = {
|
||||
/**
|
||||
* Automatically convert emoticons in your messages to emoji.
|
||||
* Automatically convert emoticons in your messages to emoji
|
||||
* For example, when you type `:-)` Discord will convert it to 😃
|
||||
* @name ClientUserSettings#convertEmoticons
|
||||
* @type {boolean}
|
||||
|
||||
@@ -5,7 +5,7 @@ const EPOCH = 1420070400000;
|
||||
let INCREMENT = 0;
|
||||
|
||||
/**
|
||||
* A container for useful snowflake-related methods
|
||||
* A container for useful snowflake-related methods.
|
||||
*/
|
||||
class SnowflakeUtil {
|
||||
constructor() {
|
||||
@@ -19,13 +19,13 @@ class SnowflakeUtil {
|
||||
*
|
||||
* 64 22 17 12 0
|
||||
* 000000111011000111100001101001000101000000 00001 00000 000000000000
|
||||
* number of ms since discord epoch worker pid increment
|
||||
* number of ms since Discord epoch worker pid increment
|
||||
* ```
|
||||
* @typedef {string} Snowflake
|
||||
*/
|
||||
|
||||
/**
|
||||
* Generates a Discord snowflake
|
||||
* Generates a Discord snowflake.
|
||||
* <info>This hardcodes the worker ID as 1 and the process ID as 0.</info>
|
||||
* @returns {Snowflake} The generated snowflake
|
||||
*/
|
||||
@@ -36,7 +36,7 @@ class SnowflakeUtil {
|
||||
}
|
||||
|
||||
/**
|
||||
* A deconstructed snowflake
|
||||
* A deconstructed snowflake.
|
||||
* @typedef {Object} DeconstructedSnowflake
|
||||
* @property {number} timestamp Timestamp the snowflake was created
|
||||
* @property {Date} date Date the snowflake was created
|
||||
@@ -47,7 +47,7 @@ class SnowflakeUtil {
|
||||
*/
|
||||
|
||||
/**
|
||||
* Deconstructs a Discord snowflake
|
||||
* Deconstructs a Discord snowflake.
|
||||
* @param {Snowflake} snowflake Snowflake to deconstruct
|
||||
* @returns {DeconstructedSnowflake} Deconstructed snowflake
|
||||
*/
|
||||
|
||||
@@ -50,7 +50,7 @@ class Util {
|
||||
* Gets the recommended shard count from Discord.
|
||||
* @param {string} token Discord auth token
|
||||
* @param {number} [guildsPerShard=1000] Number of guilds per shard
|
||||
* @returns {Promise<number>} the recommended number of shards
|
||||
* @returns {Promise<number>} The recommended number of shards
|
||||
*/
|
||||
static fetchRecommendedShards(token, guildsPerShard = 1000) {
|
||||
return new Promise((resolve, reject) => {
|
||||
@@ -90,7 +90,7 @@ class Util {
|
||||
* Checks whether the arrays are equal, also removes duplicated entries from b.
|
||||
* @param {Array<*>} a Array which will not be modified.
|
||||
* @param {Array<*>} b Array to remove duplicated entries from.
|
||||
* @returns {boolean} boolean Whether the arrays are equal.
|
||||
* @returns {boolean} Whether the arrays are equal.
|
||||
* @private
|
||||
*/
|
||||
static arraysEqual(a, b) {
|
||||
@@ -160,7 +160,7 @@ class Util {
|
||||
}
|
||||
|
||||
/**
|
||||
* Makes an Error from a plain info object
|
||||
* Makes an Error from a plain info object.
|
||||
* @param {Object} obj Error info
|
||||
* @param {string} obj.name Error type
|
||||
* @param {string} obj.message Message for the error
|
||||
@@ -176,7 +176,7 @@ class Util {
|
||||
}
|
||||
|
||||
/**
|
||||
* Makes a plain error info object from an Error
|
||||
* Makes a plain error info object from an Error.
|
||||
* @param {Error} err Error to get info from
|
||||
* @returns {Object}
|
||||
* @private
|
||||
@@ -190,7 +190,7 @@ class Util {
|
||||
}
|
||||
|
||||
/**
|
||||
* Moves an element in an array *in place*
|
||||
* Moves an element in an array *in place*.
|
||||
* @param {Array<*>} array Array to modify
|
||||
* @param {*} element Element to move
|
||||
* @param {number} newIndex Index or offset to move the element to
|
||||
|
||||
Reference in New Issue
Block a user