diff --git a/src/managers/GuildBanManager.js b/src/managers/GuildBanManager.js index 8f2c8aba2..735aeeb5b 100644 --- a/src/managers/GuildBanManager.js +++ b/src/managers/GuildBanManager.js @@ -119,10 +119,10 @@ class GuildBanManager extends BaseManager { } /** - * Options for banning a user. + * Options used to ban a user from a guild. * @typedef {Object} BanOptions - * @property {number} [days] Number of days of messages to delete, must be between 0 and 7, inclusive - * @property {string} [reason] Reason for banning + * @property {number} [days=0] Number of days of messages to delete, must be between 0 and 7, inclusive + * @property {string} [reason] The reason for the ban */ /** diff --git a/src/managers/GuildChannelManager.js b/src/managers/GuildChannelManager.js index c23f713f0..ba5ddd8ac 100644 --- a/src/managers/GuildChannelManager.js +++ b/src/managers/GuildChannelManager.js @@ -59,22 +59,27 @@ class GuildChannelManager extends BaseManager { * @returns {?Snowflake} */ + /** + * Options used to create a new channel in a guild. + * @typedef {Object} GuildChannelCreateOptions + * @property {string} [type='text'] The type of the new channel, either `text`, `voice`, `category`, `news`, + * `store`, or `stage` + * @property {string} [topic] The topic for the new channel + * @property {boolean} [nsfw] Whether the new channel is nsfw + * @property {number} [bitrate] Bitrate of the new channel in bits (only voice) + * @property {number} [userLimit] Maximum amount of users allowed in the new channel (only voice) + * @property {ChannelResolvable} [parent] Parent of the new channel + * @property {OverwriteResolvable[]|Collection} [permissionOverwrites] + * Permission overwrites of the new channel + * @property {number} [position] Position of the new channel + * @property {number} [rateLimitPerUser] The ratelimit per user for the new channel + * @property {string} [reason] Reason for creating the new channel + */ + /** * Creates a new channel in the guild. * @param {string} name The name of the new channel - * @param {Object} [options] Options - * @param {string} [options.type='text'] The type of the new channel, either `text`, `voice`, `category`, `news`, - * `store`, or `stage` - * @param {string} [options.topic] The topic for the new channel - * @param {boolean} [options.nsfw] Whether the new channel is nsfw - * @param {number} [options.bitrate] Bitrate of the new channel in bits (only voice) - * @param {number} [options.userLimit] Maximum amount of users allowed in the new channel (only voice) - * @param {ChannelResolvable} [options.parent] Parent of the new channel - * @param {OverwriteResolvable[]|Collection} [options.permissionOverwrites] - * Permission overwrites of the new channel - * @param {number} [options.position] Position of the new channel - * @param {number} [options.rateLimitPerUser] The ratelimit per user for the channel - * @param {string} [options.reason] Reason for creating the channel + * @param {GuildChannelCreateOptions} [options={}] Options for creating the new channel * @returns {Promise} * @example * // Create a new text channel diff --git a/src/managers/GuildEmojiManager.js b/src/managers/GuildEmojiManager.js index 6030f6b3e..245539a38 100644 --- a/src/managers/GuildEmojiManager.js +++ b/src/managers/GuildEmojiManager.js @@ -24,13 +24,18 @@ class GuildEmojiManager extends BaseGuildEmojiManager { return super.add(data, cache, { extras: [this.guild] }); } + /** + * Options used for creating an emoji in a guild. + * @typedef {Object} GuildEmojiCreateOptions + * @property {Collection|RoleResolvable[]} [roles] The roles to limit the emoji to + * @property {string} [reason] The reason for creating the emoji + */ + /** * Creates a new custom emoji in the guild. * @param {BufferResolvable|Base64Resolvable} attachment The image for the emoji * @param {string} name The name for the emoji - * @param {Object} [options] Options - * @param {Collection|RoleResolvable[]} [options.roles] Roles to limit the emoji to - * @param {string} [options.reason] Reason for creating the emoji + * @param {GuildEmojiCreateOptions} [options] Options for creating the emoji * @returns {Promise} The created emoji * @example * // Create a new emoji from a url diff --git a/src/managers/GuildManager.js b/src/managers/GuildManager.js index 19c8bc91d..1cad93627 100644 --- a/src/managers/GuildManager.js +++ b/src/managers/GuildManager.js @@ -50,7 +50,7 @@ class GuildManager extends BaseManager { /** * Partial data for a Role. * @typedef {Object} PartialRoleData - * @property {number} [id] The ID for this role, used to set channel overrides, + * @property {Snowflake|number} [id] The ID for this role, used to set channel overrides, * this is a placeholder and will be replaced by the API after consumption * @property {string} [name] The name of the role * @property {ColorResolvable} [color] The color of the role, either a hex string or a base 10 number @@ -63,7 +63,7 @@ class GuildManager extends BaseManager { /** * Partial overwrite data. * @typedef {Object} PartialOverwriteData - * @property {number|Snowflake} id The Role or User ID for this overwrite + * @property {Snowflake|number} id The Role or User ID for this overwrite * @property {string} [type] The type of this overwrite * @property {PermissionResolvable} [allow] The permissions to allow * @property {PermissionResolvable} [deny] The permissions to deny @@ -72,16 +72,16 @@ class GuildManager extends BaseManager { /** * Partial data for a Channel. * @typedef {Object} PartialChannelData - * @property {number} [id] The ID for this channel, used to set its parent, + * @property {Snowflake|number} [id] The ID for this channel, used to set its parent, * this is a placeholder and will be replaced by the API after consumption - * @property {number} [parentID] The parent ID for this channel + * @property {Snowflake|number} [parentID] The parent ID for this channel * @property {string} [type] The type of the channel * @property {string} name The name of the channel * @property {string} [topic] The topic of the text channel * @property {boolean} [nsfw] Whether the channel is NSFW * @property {number} [bitrate] The bitrate of the voice channel * @property {number} [userLimit] The user limit of the channel - * @property {PartialOverwriteData} [permissionOverwrites] + * @property {PartialOverwriteData[]} [permissionOverwrites] * Overwrites of the channel * @property {number} [rateLimitPerUser] The rate limit per user of the channel in seconds */ @@ -128,23 +128,28 @@ class GuildManager extends BaseManager { return super.resolveID(guild); } + /** + * Options used to create a guild. + * @typedef {Object} GuildCreateOptions + * @property {Snowflake|number} [afkChannelID] The ID of the AFK channel + * @property {number} [afkTimeout] The AFK timeout in seconds + * @property {PartialChannelData[]} [channels=[]] The channels for this guild + * @property {DefaultMessageNotifications} [defaultMessageNotifications] The default message notifications + * for the guild + * @property {ExplicitContentFilterLevel} [explicitContentFilter] The explicit content filter level for the guild + * @property {BufferResolvable|Base64Resolvable} [icon=null] The icon for the guild + * @property {PartialRoleData[]} [roles=[]] The roles for this guild, + * the first element of this array is used to change properties of the guild's everyone role. + * @property {Snowflake|number} [systemChannelID] The ID of the system channel + * @property {SystemChannelFlagsResolvable} [systemChannelFlags] The flags of the system channel + * @property {VerificationLevel} [verificationLevel] The verification level for the guild + */ + /** * Creates a guild. * This is only available to bots in fewer than 10 guilds. * @param {string} name The name of the guild - * @param {Object} [options] Options for the creating - * @param {number} [options.afkChannelID] The ID of the AFK channel - * @param {number} [options.afkTimeout] The AFK timeout in seconds - * @param {PartialChannelData[]} [options.channels] The channels for this guild - * @param {DefaultMessageNotifications} [options.defaultMessageNotifications] The default message notifications - * for the guild - * @param {ExplicitContentFilterLevel} [options.explicitContentFilter] The explicit content filter level for the guild - * @param {BufferResolvable|Base64Resolvable} [options.icon=null] The icon for the guild - * @param {PartialRoleData[]} [options.roles] The roles for this guild, - * the first element of this array is used to change properties of the guild's everyone role. - * @param {number} [options.systemChannelID] The ID of the system channel - * @param {SystemChannelFlagsResolvable} [options.systemChannelFlags] The flags of the system channel - * @param {VerificationLevel} [options.verificationLevel] The verification level for the guild + * @param {GuildCreateOptions} [options] Options for creating the guild * @returns {Promise} The guild that was created */ async create( diff --git a/src/managers/GuildMemberManager.js b/src/managers/GuildMemberManager.js index 94113a383..302cec88c 100644 --- a/src/managers/GuildMemberManager.js +++ b/src/managers/GuildMemberManager.js @@ -137,16 +137,16 @@ class GuildMemberManager extends BaseManager { } /** - * Options for searching for guild members. + * Options used for searching guild members. * @typedef {Object} GuildSearchMembersOptions * @property {string} query Filter members whose username or nickname start with this query - * @property {number} [limit] Maximum number of members to search - * @property {boolean} [cache] Whether or not to cache the fetched member(s) + * @property {number} [limit=1] Maximum number of members to search + * @property {boolean} [cache=true] Whether or not to cache the fetched member(s) */ /** - * Search for members in the guild based on a query. - * @param {GuildSearchMembersOptions} options Search options + * Searches for members in the guild based on a query. + * @param {GuildSearchMembersOptions} options Options for searching members * @returns {Promise>} */ async search({ query, limit = 1, cache = true } = {}) { @@ -196,19 +196,19 @@ class GuildMemberManager extends BaseManager { } /** - * Options for pruning guild members. + * Options used for pruning guild members. * @typedef {Object} GuildPruneMembersOptions - * @property {number} [days] Number of days of inactivity required to kick - * @property {boolean} [dry] Get number of users that will be kicked, without actually kicking them - * @property {boolean} [count] Whether or not to return the number of users that have been kicked. + * @property {number} [days=7] Number of days of inactivity required to kick + * @property {boolean} [dry=false] Get the number of users that will be kicked, without actually kicking them + * @property {boolean} [count=true] Whether or not to return the number of users that have been kicked. * @property {RoleResolvable[]} [roles] Array of roles to bypass the "...and no roles" constraint when pruning * @property {string} [reason] Reason for this prune */ /** * Prunes members from the guild based on how long they have been inactive. - * It's recommended to set options.count to `false` for large guilds. - * @param {GuildPruneMembersOptions} [options] Prune options + * It's recommended to set `options.count` to `false` for large guilds. + * @param {GuildPruneMembersOptions} [options] Options for pruning * @returns {Promise} The number of members that were/will be kicked * @example * // See how many members will be pruned diff --git a/src/managers/ReactionUserManager.js b/src/managers/ReactionUserManager.js index 77d6ab5d5..4e4e294be 100644 --- a/src/managers/ReactionUserManager.js +++ b/src/managers/ReactionUserManager.js @@ -24,11 +24,16 @@ class ReactionUserManager extends BaseManager { * @name ReactionUserManager#cache */ + /** + * Options used to fetch users who gave a reaction. + * @typedef {Object} FetchReactionUsersOptions + * @property {number} [limit=100] The maximum amount of users to fetch, defaults to `100` + * @property {Snowflake} [after] Limit fetching users to those with an id greater than the supplied id + */ + /** * Fetches all the users that gave this reaction. Resolves with a collection of users, mapped by their IDs. - * @param {Object} [options] Options for fetching the users - * @param {number} [options.limit=100] The maximum amount of users to fetch, defaults to 100 - * @param {Snowflake} [options.after] Limit fetching users to those with an id greater than the supplied id + * @param {FetchReactionUsersOptions} [options] Options for fetching the users * @returns {Promise>} */ async fetch({ limit = 100, after } = {}) { diff --git a/src/managers/RoleManager.js b/src/managers/RoleManager.js index e9e58ffe6..98135cb84 100644 --- a/src/managers/RoleManager.js +++ b/src/managers/RoleManager.js @@ -84,17 +84,22 @@ class RoleManager extends BaseManager { * @returns {?Snowflake} */ + /** + * Options used to create a new role. + * @typedef {Object} CreateRoleOptions + * @property {string} [name] The name of the new role + * @property {ColorResolvable} [color] The data to create the role with + * @property {boolean} [hoist] Whether or not the new role should be hoisted + * @property {PermissionResolvable} [permissions] The permissions for the new role + * @property {number} [position] The position of the new role + * @property {boolean} [mentionable] Whether or not the new role should be mentionable + * @property {string} [reason] The reason for creating this role + */ + /** * Creates a new role in the guild with given information. * The position will silently reset to 1 if an invalid one is provided, or none. - * @param {Object} [options] Options - * @param {string} [options.name] The name of the new role - * @param {ColorResolvable} [options.color] The data to create the role with - * @param {boolean} [options.hoist] Whether or not the new role should be hoisted. - * @param {PermissionResolvable} [options.permissions] The permissions for the new role - * @param {number} [options.position] The position of the new role - * @param {boolean} [options.mentionable] Whether or not the new role should be mentionable. - * @param {string} [options.reason] Reason for creating this role + * @param {CreateRoleOptions} [options] Options for creating the new role * @returns {Promise} * @example * // Create a new role diff --git a/src/rest/RequestHandler.js b/src/rest/RequestHandler.js index c2256a67e..128267669 100644 --- a/src/rest/RequestHandler.js +++ b/src/rest/RequestHandler.js @@ -125,13 +125,7 @@ class RequestHandler { /** * Emitted when the client hits a rate limit while making a request * @event Client#rateLimit - * @param {Object} rateLimitInfo Object containing the rate limit info - * @param {number} rateLimitInfo.timeout Timeout in ms - * @param {number} rateLimitInfo.limit Number of requests that can be made to this endpoint - * @param {string} rateLimitInfo.method HTTP method used for request that triggered this event - * @param {string} rateLimitInfo.path Path used for request that triggered this event - * @param {string} rateLimitInfo.route Route used for request that triggered this event - * @param {boolean} rateLimitInfo.global Whether the rate limit that was reached was the global limit + * @param {RateLimitData} rateLimitData Object containing the rate limit info */ this.manager.client.emit(RATE_LIMIT, { timeout, @@ -232,11 +226,16 @@ class RequestHandler { invalidCount % this.manager.client.options.invalidRequestWarningInterval === 0; if (emitInvalid) { /** - * Emitted periodically when the process sends invalid messages to let users avoid the + * @typedef {Object} InvalidRequestWarningData + * @property {number} count Number of invalid requests that have been made in the window + * @property {number} remainingTime Time in ms remaining before the count resets + */ + + /** + * Emitted periodically when the process sends invalid requests to let users avoid the * 10k invalid requests in 10 minutes threshold that causes a ban * @event Client#invalidRequestWarning - * @param {number} invalidRequestWarningInfo.count Number of invalid requests that have been made in the window - * @param {number} invalidRequestWarningInfo.remainingTime Time in ms remaining before the count resets + * @param {InvalidRequestWarningData} invalidRequestWarningData Object containing the invalid request info */ this.manager.client.emit(INVALID_REQUEST_WARNING, { count: invalidCount, diff --git a/src/sharding/Shard.js b/src/sharding/Shard.js index 6f840c714..59479a5ed 100644 --- a/src/sharding/Shard.js +++ b/src/sharding/Shard.js @@ -103,7 +103,7 @@ class Shard extends EventEmitter { * Forks a child process or creates a worker thread for the shard. * You should not need to call this manually. * @param {number} [timeout=30000] The amount in milliseconds to wait until the {@link Client} has become ready - * before resolving. (-1 or Infinity for no wait) + * before resolving (`-1` or `Infinity` for no wait) * @returns {Promise} */ async spawn(timeout = 30000) { @@ -187,13 +187,17 @@ class Shard extends EventEmitter { } /** - * Kills and restarts the shard's process/worker. - * @param {Object} [options] Respawn options for the shard - * @param {number} [options.delay=500] How long to wait between killing the process/worker and + * Options used to respawn a shard. + * @typedef {Object} ShardRespawnOptions + * @property {number} [delay=500] How long to wait between killing the process/worker and * restarting it (in milliseconds) - * @param {number} [options.timeout=30000] The amount in milliseconds to wait until the {@link Client} - * has become ready - * before resolving. (-1 or Infinity for no wait) + * @property {number} [timeout=30000] The amount in milliseconds to wait until the {@link Client} + * has become ready before resolving (`-1` or `Infinity` for no wait) + */ + + /** + * Kills and restarts the shard's process/worker. + * @param {ShardRespawnOptions} [options] Options for respawning the shard * @returns {Promise} */ async respawn({ delay = 500, timeout = 30000 } = {}) { diff --git a/src/sharding/ShardClientUtil.js b/src/sharding/ShardClientUtil.js index 47230e418..74baa3daf 100644 --- a/src/sharding/ShardClientUtil.js +++ b/src/sharding/ShardClientUtil.js @@ -163,12 +163,7 @@ class ShardClientUtil { /** * Requests a respawn of all shards. - * @param {Object} [options] Options for respawning shards - * @param {number} [options.shardDelay=5000] How long to wait between shards (in milliseconds) - * @param {number} [options.respawnDelay=500] How long to wait between killing a shard's process/worker and - * restarting it (in milliseconds) - * @param {number} [options.timeout=30000] The amount in milliseconds to wait for a shard to become ready before - * continuing to another. (-1 or Infinity for no wait) + * @param {MultipleShardRespawnOptions} [options] Options for respawning shards * @returns {Promise} Resolves upon the message being sent * @see {@link ShardingManager#respawnAll} */ diff --git a/src/sharding/ShardingManager.js b/src/sharding/ShardingManager.js index cf43553ac..5e942c049 100644 --- a/src/sharding/ShardingManager.js +++ b/src/sharding/ShardingManager.js @@ -25,7 +25,7 @@ class ShardingManager extends EventEmitter { */ /** - * The options to spawn shards with for a {@link ShardingManager}, + * The options to spawn shards with for a {@link ShardingManager}. * @typedef {Object} ShardingManagerOptions * @property {string|number} [totalShards='auto'] Number of total shards of all shard managers or "auto" * @property {string|number[]} [shardList='auto'] List of shards to spawn or "auto" @@ -164,12 +164,17 @@ class ShardingManager extends EventEmitter { return shard; } + /** + * Option used to spawn multiple shards. + * @typedef {Object} MultipleShardSpawnOptions + * @property {number|string} [amount=this.totalShards] Number of shards to spawn + * @property {number} [delay=5500] How long to wait in between spawning each shard (in milliseconds) + * @property {number} [timeout=30000] The amount in milliseconds to wait until the {@link Client} has become ready + */ + /** * Spawns multiple shards. - * @param {Object} [options] Options for spawning shards - * @param {number|string} [options.amount=this.totalShards] Number of shards to spawn - * @param {number} [options.delay=5500] How long to wait in between spawning each shard (in milliseconds) - * @param {number} [options.timeout=30000] The amount in milliseconds to wait until the {@link Client} has become + * @param {MultipleShardSpawnOptions} [options] Options for spawning shards * @returns {Promise>} */ async spawn({ amount = this.totalShards, delay = 5500, timeout = 30000 } = {}) { @@ -282,13 +287,18 @@ class ShardingManager extends EventEmitter { } /** - * Kills all running shards and respawns them. - * @param {Object} [options] Options for respawning shards - * @param {number} [options.shardDelay=5000] How long to wait between shards (in milliseconds) - * @param {number} [options.respawnDelay=500] How long to wait between killing a shard's process and restarting it + * Options used to respawn all shards. + * @typedef {Object} MultipleShardRespawnOptions + * @property {number} [shardDelay=5000] How long to wait between shards (in milliseconds) + * @property {number} [respawnDelay=500] How long to wait between killing a shard's process and restarting it * (in milliseconds) - * @param {number} [options.timeout=30000] The amount in milliseconds to wait for a shard to become ready before - * continuing to another. (-1 or Infinity for no wait) + * @property {number} [timeout=30000] The amount in milliseconds to wait for a shard to become ready before + * continuing to another (`-1` or `Infinity` for no wait) + */ + + /** + * Kills all running shards and respawns them. + * @param {MultipleShardRespawnOptions} [options] Options for respawning shards * @returns {Promise>} */ async respawnAll({ shardDelay = 5000, respawnDelay = 500, timeout = 30000 } = {}) { diff --git a/src/structures/CategoryChannel.js b/src/structures/CategoryChannel.js index 4ba014067..7387a950e 100644 --- a/src/structures/CategoryChannel.js +++ b/src/structures/CategoryChannel.js @@ -22,10 +22,8 @@ class CategoryChannel extends GuildChannel { * @method setParent * @memberof CategoryChannel * @instance - * @param {?GuildChannel|Snowflake} channel Parent channel - * @param {Object} [options={}] Options to pass - * @param {boolean} [options.lockPermissions=true] Lock the permissions to what the parent's permissions are - * @param {string} [options.reason] Reason for modifying the parent of this channel + * @param {?(GuildChannel|Snowflake)} channel The channel to set as parent + * @param {SetParentOptions} [options={}] The options for setting the parent * @returns {Promise} */ } diff --git a/src/structures/Guild.js b/src/structures/Guild.js index af0daba89..77afa232f 100644 --- a/src/structures/Guild.js +++ b/src/structures/Guild.js @@ -727,13 +727,18 @@ class Guild extends BaseGuild { }; } + /** + * Options used to fetch audit logs. + * @typedef {Object} GuildAuditLogsFetchOptions + * @property {Snowflake|GuildAuditLogsEntry} [before] Only return entries before this entry + * @property {number} [limit] The number of entries to return + * @property {UserResolvable} [user] Only return entries for actions made by this user + * @property {AuditLogAction|number} [type] Only return entries for this action type + */ + /** * Fetches audit logs for this guild. - * @param {Object} [options={}] Options for fetching audit logs - * @param {Snowflake|GuildAuditLogsEntry} [options.before] Limit to entries from before specified entry - * @param {number} [options.limit] Limit number of entries - * @param {UserResolvable} [options.user] Only show entries involving this user - * @param {AuditLogAction|number} [options.type] Only show entries involving this action type + * @param {GuildAuditLogsFetchOptions} [options={}] Options for fetching audit logs * @returns {Promise} * @example * // Output audit log entries @@ -759,16 +764,21 @@ class Guild extends BaseGuild { } /** - * Adds a user to the guild using OAuth2. Requires the `CREATE_INSTANT_INVITE` permission. - * @param {UserResolvable} user User to add to the guild - * @param {Object} options Options for the addition - * @param {string} options.accessToken An OAuth2 access token for the user with the `guilds.join` scope granted to the + * Options used to add a user to a guild using OAuth2. + * @typedef {Object} AddGuildMemberOptions + * @property {string} accessToken An OAuth2 access token for the user with the `guilds.join` scope granted to the * bot's application - * @param {string} [options.nick] Nickname to give the member (requires `MANAGE_NICKNAMES`) - * @param {Collection|RoleResolvable[]} [options.roles] Roles to add to the member + * @property {string} [nick] The nickname to give to the member (requires `MANAGE_NICKNAMES`) + * @property {Collection|RoleResolvable[]} [roles] The roles to add to the member * (requires `MANAGE_ROLES`) - * @param {boolean} [options.mute] Whether the member should be muted (requires `MUTE_MEMBERS`) - * @param {boolean} [options.deaf] Whether the member should be deafened (requires `DEAFEN_MEMBERS`) + * @property {boolean} [mute] Whether the member should be muted (requires `MUTE_MEMBERS`) + * @property {boolean} [deaf] Whether the member should be deafened (requires `DEAFEN_MEMBERS`) + */ + + /** + * Adds a user to the guild using OAuth2. Requires the `CREATE_INSTANT_INVITE` permission. + * @param {UserResolvable} user The user to add to the guild + * @param {AddGuildMemberOptions} options Options for adding the user to the guild * @returns {Promise} */ async addMember(user, options) { diff --git a/src/structures/GuildChannel.js b/src/structures/GuildChannel.js index 5fc187902..92fc08726 100644 --- a/src/structures/GuildChannel.js +++ b/src/structures/GuildChannel.js @@ -452,11 +452,16 @@ class GuildChannel extends Channel { } /** - * Sets the category parent of this channel. - * @param {?CategoryChannel|Snowflake} channel Parent channel - * @param {Object} [options={}] Options to pass - * @param {boolean} [options.lockPermissions=true] Lock the permissions to what the parent's permissions are - * @param {string} [options.reason] Reason for modifying the parent of this channel + * Options used to set parent of a channel. + * @typedef {Object} SetParentOptions + * @property {boolean} [lockPermissions=true] Whether to lock the permissions to what the parent's permissions are + * @property {string} [reason] The reason for modifying the parent of the channel + */ + + /** + * Sets the parent of this channel. + * @param {?(CategoryChannel|Snowflake)} channel The category channel to set as parent + * @param {SetParentOptions} [options={}] The options for setting the parent * @returns {Promise} * @example * // Add a parent to a channel @@ -490,12 +495,17 @@ class GuildChannel extends Channel { return this.edit({ topic }, reason); } + /** + * Options used to set position of a channel. + * @typedef {Object} SetChannelPositionOptions + * @param {boolean} [relative=false] Whether or not to change the position relative to its current value + * @param {string} [reason] The reason for changing the position + */ + /** * Sets a new position for the guild channel. * @param {number} position The new position for the guild channel - * @param {Object} [options] Options for setting position - * @param {boolean} [options.relative=false] Change the position relative to its current value - * @param {string} [options.reason] Reason for changing the position + * @param {SetChannelPositionOptions} [options] Options for setting position * @returns {Promise} * @example * // Set a new channel position @@ -529,19 +539,24 @@ class GuildChannel extends Channel { */ /** - * Creates an invite to this guild channel. - * @param {Object} [options={}] Options for the invite - * @param {boolean} [options.temporary=false] Whether members that joined via the invite should be automatically + * Options used to create an invite to a guild channel. + * @typedef {Object} CreateInviteOptions + * @property {boolean} [temporary=false] Whether members that joined via the invite should be automatically * kicked after 24 hours if they have not yet received a role - * @param {number} [options.maxAge=86400] How long the invite should last (in seconds, 0 for forever) - * @param {number} [options.maxUses=0] Maximum number of uses - * @param {boolean} [options.unique=false] Create a unique invite, or use an existing one with similar settings - * @param {UserResolvable} [options.targetUser] The user whose stream to display for this invite, + * @property {number} [maxAge=86400] How long the invite should last (in seconds, 0 for forever) + * @property {number} [maxUses=0] Maximum number of uses + * @property {boolean} [unique=false] Create a unique invite, or use an existing one with similar settings + * @property {UserResolvable} [targetUser] The user whose stream to display for this invite, * required if `targetType` is 1, the user must be streaming in the channel - * @param {ApplicationResolvable} [options.targetApplication] The embedded application to open for this invite, + * @property {ApplicationResolvable} [targetApplication] The embedded application to open for this invite, * required if `targetType` is 2, the application must have the `EMBEDDED` flag - * @param {InviteTargetType} [options.targetType] The type of the target for this voice channel invite - * @param {string} [options.reason] Reason for creating this + * @property {InviteTargetType} [targetType] The type of the target for this voice channel invite + * @property {string} [reason] The reason for creating the invite + */ + + /** + * Creates an invite to this guild channel. + * @param {CreateInviteOptions} [options={}] The options for creating the invite * @returns {Promise} * @example * // Create an invite to a channel @@ -591,22 +606,15 @@ class GuildChannel extends Channel { return invites; } - /* eslint-disable max-len */ + /** + * Options used to clone a guild channel. + * @typedef {GuildChannelCreateOptions} GuildChannelCloneOptions + * @property {string} [name=this.name] Name of the new channel + */ + /** * Clones this channel. - * @param {Object} [options] The options - * @param {string} [options.name=this.name] Name of the new channel - * @param {OverwriteResolvable[]|Collection} [options.permissionOverwrites=this.permissionOverwrites] - * Permission overwrites of the new channel - * @param {string} [options.type=this.type] Type of the new channel - * @param {string} [options.topic=this.topic] Topic of the new channel (only text) - * @param {boolean} [options.nsfw=this.nsfw] Whether the new channel is nsfw (only text) - * @param {number} [options.bitrate=this.bitrate] Bitrate of the new channel in bits (only voice) - * @param {number} [options.userLimit=this.userLimit] Maximum amount of users allowed in the new channel (only voice) - * @param {number} [options.rateLimitPerUser=this.rateLimitPerUser] Ratelimit per user for the new channel (only text) - * @param {number} [options.position=this.position] Position of the new channel - * @param {ChannelResolvable} [options.parent=this.parent] Parent of the new channel - * @param {string} [options.reason] Reason for cloning this channel + * @param {GuildChannelCloneOptions} [options] The options for cloning this channel * @returns {Promise} */ clone(options = {}) { @@ -624,7 +632,6 @@ class GuildChannel extends Channel { ...options, }); } - /* eslint-enable max-len */ /** * Checks if this channel has the same type, topic, position, name, overwrites and ID as another channel. diff --git a/src/structures/GuildMember.js b/src/structures/GuildMember.js index 1b78e5674..f0cfb75e7 100644 --- a/src/structures/GuildMember.js +++ b/src/structures/GuildMember.js @@ -323,9 +323,7 @@ class GuildMember extends Base { /** * Bans this guild member. - * @param {Object} [options] Options for the ban - * @param {number} [options.days=0] Number of days of messages to delete, must be between 0 and 7, inclusive - * @param {string} [options.reason] Reason for banning + * @param {BanOptions} [options] Options for the ban * @returns {Promise} * @example * // ban a guild member diff --git a/src/structures/GuildTemplate.js b/src/structures/GuildTemplate.js index 4285d8bb9..d86fd6427 100644 --- a/src/structures/GuildTemplate.js +++ b/src/structures/GuildTemplate.js @@ -136,10 +136,15 @@ class GuildTemplate extends Base { } /** - * Updates the metadata on this template. - * @param {Object} options Options for the template - * @param {string} [options.name] The name of this template - * @param {string} [options.description] The description of this template + * Options used to edit a guild template. + * @typedef {Object} EditGuildTemplateOptions + * @property {string} [name] The name of this template + * @property {string} [description] The description of this template + */ + + /** + * Updates the metadata of this template. + * @param {EditGuildTemplateOptions} [options] Options for editing the template * @returns {Promise} */ edit({ name, description } = {}) { diff --git a/src/structures/MessageComponentInteractionCollector.js b/src/structures/MessageComponentInteractionCollector.js index 36db24f56..07105ab5a 100644 --- a/src/structures/MessageComponentInteractionCollector.js +++ b/src/structures/MessageComponentInteractionCollector.js @@ -83,7 +83,7 @@ class MessageComponentInteractionCollector extends Collector { /** * Handles an incoming interaction for possible collection. * @param {Interaction} interaction The interaction to possibly collect - * @returns {?Snowflake|string} + * @returns {?(Snowflake|string)} * @private */ collect(interaction) { diff --git a/src/structures/MessageMentions.js b/src/structures/MessageMentions.js index d4f2b039b..d4d5fd52a 100644 --- a/src/structures/MessageMentions.js +++ b/src/structures/MessageMentions.js @@ -161,14 +161,19 @@ class MessageMentions { return this._channels; } + /** + * Options used to check for a mention. + * @typedef {Object} MessageMentionsHasOptions + * @property {boolean} [ignoreDirect=false] Whether to ignore direct mentions to the item + * @property {boolean} [ignoreRoles=false] Whether to ignore role mentions to a guild member + * @property {boolean} [ignoreEveryone=false] Whether to ignore everyone/here mentions + */ + /** * Checks if a user, guild member, role, or channel is mentioned. - * Takes into account user mentions, role mentions, and @everyone/@here mentions. - * @param {UserResolvable|RoleResolvable|ChannelResolvable} data User/Role/Channel to check - * @param {Object} [options] Options - * @param {boolean} [options.ignoreDirect=false] - Whether to ignore direct mentions to the item - * @param {boolean} [options.ignoreRoles=false] - Whether to ignore role mentions to a guild member - * @param {boolean} [options.ignoreEveryone=false] - Whether to ignore everyone/here mentions + * Takes into account user mentions, role mentions, and `@everyone`/`@here` mentions. + * @param {UserResolvable|RoleResolvable|ChannelResolvable} data The User/Role/Channel to check for + * @param {MessageMentionsHasOptions} [options] The options for the check * @returns {boolean} */ has(data, { ignoreDirect = false, ignoreRoles = false, ignoreEveryone = false } = {}) { diff --git a/src/structures/ReactionCollector.js b/src/structures/ReactionCollector.js index 443c258a7..70a32fcb2 100644 --- a/src/structures/ReactionCollector.js +++ b/src/structures/ReactionCollector.js @@ -82,7 +82,7 @@ class ReactionCollector extends Collector { * Handles an incoming reaction for possible collection. * @param {MessageReaction} reaction The reaction to possibly collect * @param {User} user The user that added the reaction - * @returns {?Snowflake|string} + * @returns {?(Snowflake|string)} * @private */ collect(reaction, user) { @@ -113,7 +113,7 @@ class ReactionCollector extends Collector { * Handles a reaction deletion for possible disposal. * @param {MessageReaction} reaction The reaction to possibly dispose of * @param {User} user The user that removed the reaction - * @returns {?Snowflake|string} + * @returns {?(Snowflake|string)} */ dispose(reaction, user) { /** diff --git a/src/structures/Role.js b/src/structures/Role.js index 91922c097..392faa14f 100644 --- a/src/structures/Role.js +++ b/src/structures/Role.js @@ -323,11 +323,16 @@ class Role extends Base { } /** - * Sets the position of the role. - * @param {number} position The position of the role - * @param {Object} [options] Options for setting position - * @param {boolean} [options.relative=false] Change the position relative to its current value - * @param {string} [options.reason] Reason for changing the position + * Options used to set position of a role. + * @typedef {Object} SetRolePositionOptions + * @property {boolean} [relative=false] Whether to change the position relative to its current value or not + * @property {string} [reason] The reason for changing the position + */ + + /** + * Sets the new position of the role. + * @param {number} position The new position for the role + * @param {SetRolePositionOptions} [options] Options for setting the position * @returns {Promise} * @example * // Set the position of the role diff --git a/src/structures/interfaces/Collector.js b/src/structures/interfaces/Collector.js index 5d1fdbff2..d16269c48 100644 --- a/src/structures/interfaces/Collector.js +++ b/src/structures/interfaces/Collector.js @@ -194,10 +194,16 @@ class Collector extends EventEmitter { } /** - * Resets the collectors timeout and idle timer. - * @param {Object} [options] Options - * @param {number} [options.time] How long to run the collector for in milliseconds - * @param {number} [options.idle] How long to stop the collector after inactivity in milliseconds + * Options used to reset timeout and idle timer of a {@link Collector}. + * @typedef {Object} CollectorResetTimerOptions + * @property {number} [time] How long to run the collector for (in milliseconds) + * @property {number} [idle] How long to wait to stop the collector after inactivity (in milliseconds) + */ + + /** + * Resets the collector's timeout and idle timer. + * @param {CollectorResetTimerOptions} [options] Options for reseting + */ resetTimer({ time, idle } = {}) { if (this._timeout) { diff --git a/src/util/Util.js b/src/util/Util.js index 9df2f0935..625114be2 100644 --- a/src/util/Util.js +++ b/src/util/Util.js @@ -90,19 +90,24 @@ class Util { return messages.concat(msg).filter(m => m); } + /** + * Options used to escape markdown. + * @typedef {Object} EscapeMarkdownOptions + * @property {boolean} [codeBlock=true] Whether to escape code blocks or not + * @property {boolean} [inlineCode=true] Whether to escape inline code or not + * @property {boolean} [bold=true] Whether to escape bolds or not + * @property {boolean} [italic=true] Whether to escape italics or not + * @property {boolean} [underline=true] Whether to escape underlines or not + * @property {boolean} [strikethrough=true] Whether to escape strikethroughs or not + * @property {boolean} [spoiler=true] Whether to escape spoilers or not + * @property {boolean} [codeBlockContent=true] Whether to escape text inside code blocks or not + * @property {boolean} [inlineCodeContent=true] Whether to escape text inside inline code or not + */ + /** * Escapes any Discord-flavour markdown in a string. * @param {string} text Content to escape - * @param {Object} [options={}] What types of markdown to escape - * @param {boolean} [options.codeBlock=true] Whether to escape code blocks or not - * @param {boolean} [options.inlineCode=true] Whether to escape inline code or not - * @param {boolean} [options.bold=true] Whether to escape bolds or not - * @param {boolean} [options.italic=true] Whether to escape italics or not - * @param {boolean} [options.underline=true] Whether to escape underlines or not - * @param {boolean} [options.strikethrough=true] Whether to escape strikethroughs or not - * @param {boolean} [options.spoiler=true] Whether to escape spoilers or not - * @param {boolean} [options.codeBlockContent=true] Whether to escape text inside code blocks or not - * @param {boolean} [options.inlineCodeContent=true] Whether to escape text inside inline code or not + * @param {EscapeMarkdownOptions} [options={}] Options for escaping the markdown * @returns {string} */ static escapeMarkdown( @@ -323,12 +328,17 @@ class Util { return given; } + /** + * Options used to make an error object. + * @typedef {Object} MakeErrorOptions + * @property {string} name Error type + * @property {string} message Message for the error + * @property {string} stack Stack for the error + */ + /** * 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 - * @param {string} obj.stack Stack for the error + * @param {MakeErrorOptions} obj Error info * @returns {Error} * @private */ @@ -342,7 +352,7 @@ class Util { /** * Makes a plain error info object from an Error. * @param {Error} err Error to get info from - * @returns {Object} + * @returns {MakeErrorOptions} * @private */ static makePlainError(err) { diff --git a/typings/index.d.ts b/typings/index.d.ts index 3972b16d1..fe593b717 100644 --- a/typings/index.d.ts +++ b/typings/index.d.ts @@ -422,7 +422,7 @@ declare module 'discord.js' { public handleCollect(...args: any[]): void; public handleDispose(...args: any[]): void; public stop(reason?: string): void; - public resetTimer(options?: { time?: number; idle?: number }): void; + public resetTimer(options?: CollectorResetTimerOptions): void; public [Symbol.asyncIterator](): AsyncIterableIterator; public toJSON(): unknown; @@ -890,7 +890,7 @@ declare module 'discord.js' { public type: Exclude; public readonly viewable: boolean; public clone(options?: GuildChannelCloneOptions): Promise; - public createInvite(options?: InviteOptions): Promise; + public createInvite(options?: CreateInviteOptions): Promise; public createOverwrite( userOrRole: RoleResolvable | UserResolvable, options: PermissionOverwriteOptions, @@ -907,11 +907,8 @@ declare module 'discord.js' { public permissionsFor(memberOrRole: GuildMember | Role): Readonly; public permissionsFor(memberOrRole: GuildMemberResolvable | RoleResolvable): Readonly | null; public setName(name: string, reason?: string): Promise; - public setParent( - channel: CategoryChannel | Snowflake | null, - options?: { lockPermissions?: boolean; reason?: string }, - ): Promise; - public setPosition(position: number, options?: { relative?: boolean; reason?: string }): Promise; + public setParent(channel: CategoryChannel | Snowflake | null, options?: SetParentOptions): Promise; + public setPosition(position: number, options?: SetChannelPositionOptions): Promise; public setTopic(topic: string | null, reason?: string): Promise; public updateOverwrite( userOrRole: RoleResolvable | UserResolvable, @@ -1013,7 +1010,7 @@ declare module 'discord.js' { public unSynced: boolean | null; public createGuild(name: string, icon?: BufferResolvable | Base64Resolvable): Promise; public delete(): Promise; - public edit(options?: { name?: string; description?: string }): Promise; + public edit(options?: EditGuildTemplateOptions): Promise; public sync(): Promise; public static GUILD_TEMPLATES_PATTERN: RegExp; } @@ -1398,14 +1395,7 @@ declare module 'discord.js' { public readonly client: Client; public everyone: boolean; public readonly guild: Guild; - public has( - data: UserResolvable | RoleResolvable | ChannelResolvable, - options?: { - ignoreDirect?: boolean; - ignoreRoles?: boolean; - ignoreEveryone?: boolean; - }, - ): boolean; + public has(data: UserResolvable | RoleResolvable | ChannelResolvable, options?: MessageMentionsHasOptions): boolean; public readonly members: Collection | null; public roles: Collection; public users: Collection; @@ -1583,7 +1573,7 @@ declare module 'discord.js' { public setMentionable(mentionable: boolean, reason?: string): Promise; public setName(name: string, reason?: string): Promise; public setPermissions(permissions: PermissionResolvable, reason?: string): Promise; - public setPosition(position: number, options?: { relative?: boolean; reason?: string }): Promise; + public setPosition(position: number, options?: SetRolePositionOptions): Promise; public toJSON(): unknown; public toString(): string; @@ -1646,7 +1636,7 @@ declare module 'discord.js' { ): Promise; public fetchClientValues(prop: string): Promise; public fetchClientValues(prop: string, shard: number): Promise; - public respawnAll(options?: { shardDelay?: number; respawnDelay?: number; timeout?: number }): Promise; + public respawnAll(options?: MultipleShardRespawnOptions): Promise; public send(message: any): Promise; public static singleton(client: Client, mode: ShardingManagerMode): ShardClientUtil; @@ -1676,16 +1666,8 @@ declare module 'discord.js' { public createShard(id: number): Shard; public fetchClientValues(prop: string): Promise; public fetchClientValues(prop: string, shard: number): Promise; - public respawnAll(options?: { - shardDelay?: number; - respawnDelay?: number; - timeout?: number; - }): Promise>; - public spawn(options?: { - amount?: number | 'auto'; - delay?: number; - timeout?: number; - }): Promise>; + public respawnAll(options?: MultipleShardRespawnOptions): Promise>; + public spawn(options?: MultipleShardSpawnOptions): Promise>; public on(event: 'shardCreate', listener: (shard: Shard) => Awaited): this; @@ -1826,8 +1808,8 @@ declare module 'discord.js' { public static fetchRecommendedShards(token: string, guildsPerShard?: number): Promise; public static flatten(obj: unknown, ...props: { [key: string]: boolean | string }[]): unknown; public static idToBinary(num: Snowflake): string; - public static makeError(obj: { name: string; message: string; stack: string }): Error; - public static makePlainError(err: Error): { name: string; message: string; stack: string }; + public static makeError(obj: MakeErrorOptions): Error; + public static makePlainError(err: Error): MakeErrorOptions; public static mergeDefault(def: unknown, given: unknown): unknown; public static moveElementInArray(array: any[], element: any, newIndex: number, offset?: boolean): number; public static parseEmoji(text: string): { animated: boolean; name: string; id: Snowflake | null } | null; @@ -2132,15 +2114,15 @@ declare module 'discord.js' { export class GuildChannelManager extends BaseManager { constructor(guild: Guild, iterable?: Iterable); public guild: Guild; - public create(name: string, options: GuildCreateChannelOptions & { type: 'voice' }): Promise; - public create(name: string, options: GuildCreateChannelOptions & { type: 'category' }): Promise; - public create(name: string, options?: GuildCreateChannelOptions & { type?: 'text' }): Promise; - public create(name: string, options: GuildCreateChannelOptions & { type: 'news' }): Promise; - public create(name: string, options: GuildCreateChannelOptions & { type: 'store' }): Promise; - public create(name: string, options: GuildCreateChannelOptions & { type: 'stage' }): Promise; + public create(name: string, options: GuildChannelCreateOptions & { type: 'voice' }): Promise; + public create(name: string, options: GuildChannelCreateOptions & { type: 'category' }): Promise; + public create(name: string, options?: GuildChannelCreateOptions & { type?: 'text' }): Promise; + public create(name: string, options: GuildChannelCreateOptions & { type: 'news' }): Promise; + public create(name: string, options: GuildChannelCreateOptions & { type: 'store' }): Promise; + public create(name: string, options: GuildChannelCreateOptions & { type: 'stage' }): Promise; public create( name: string, - options: GuildCreateChannelOptions, + options: GuildChannelCreateOptions, ): Promise; public fetch( id: Snowflake, @@ -2267,7 +2249,7 @@ declare module 'discord.js' { export class ReactionUserManager extends BaseManager { constructor(client: Client, iterable: Iterable | undefined, reaction: MessageReaction); public reaction: MessageReaction; - public fetch(options?: { limit?: number; after?: Snowflake }): Promise>; + public fetch(options?: FetchReactionUsersOptions): Promise>; public remove(user?: UserResolvable): Promise; } @@ -2278,9 +2260,9 @@ declare module 'discord.js' { public guild: Guild; public readonly premiumSubscriberRole: Role | null; public botRoleFor(user: UserResolvable): Role | null; - public create(options?: RoleData & { reason?: string }): Promise; public fetch(id: Snowflake, options?: BaseFetchOptions): Promise; public fetch(id?: Snowflake, options?: BaseFetchOptions): Promise>; + public create(options?: CreateRoleOptions): Promise; } export class UserManager extends BaseManager { @@ -2717,6 +2699,11 @@ declare module 'discord.js' { dispose?: boolean; } + interface CollectorResetTimerOptions { + time?: number; + idle?: number; + } + type ColorResolvable = | 'DEFAULT' | 'WHITE' @@ -2764,6 +2751,10 @@ declare module 'discord.js' { role?: Role | RawRole; } + interface CreateRoleOptions extends RoleData { + reason?: string; + } + interface CrosspostedChannel { channelID: Snowflake; guildID: Snowflake; @@ -2782,6 +2773,11 @@ declare module 'discord.js' { type DefaultMessageNotifications = 'ALL' | 'MENTIONS'; + interface EditGuildTemplateOptions { + name?: string; + description?: string; + } + interface EmbedField { name: string; value: string; @@ -2877,6 +2873,11 @@ declare module 'discord.js' { type FetchOwnerOptions = Omit; + interface FetchReactionUsersOptions { + limit?: number; + after?: Snowflake; + } + interface FileOptions { attachment: BufferResolvable | Stream; name?: string; @@ -2962,7 +2963,7 @@ declare module 'discord.js' { type GuildChannelResolvable = Snowflake | GuildChannel; - interface GuildCreateChannelOptions { + interface GuildChannelCreateOptions { permissionOverwrites?: OverwriteResolvable[] | Collection; topic?: string; type?: Exclude< @@ -2978,12 +2979,12 @@ declare module 'discord.js' { reason?: string; } - interface GuildChannelCloneOptions extends GuildCreateChannelOptions { + interface GuildChannelCloneOptions extends GuildChannelCreateOptions { name?: string; } interface GuildCreateOptions { - afkChannelID?: number; + afkChannelID?: Snowflake | number; afkTimeout?: number; channels?: PartialChannelData[]; defaultMessageNotifications?: DefaultMessageNotifications | number; @@ -2991,7 +2992,7 @@ declare module 'discord.js' { icon?: BufferResolvable | Base64Resolvable | null; roles?: PartialRoleData[]; systemChannelFlags?: SystemChannelFlagsResolvable; - systemChannelID?: number; + systemChannelID?: Snowflake | number; verificationLevel?: VerificationLevel | number; } @@ -3083,6 +3084,8 @@ declare module 'discord.js' { cache?: boolean; } + type GuildTemplateResolvable = string; + interface HTTPAttachmentData { attachment: string | Buffer | Stream; name: string; @@ -3161,7 +3164,7 @@ declare module 'discord.js' { additionalScopes?: InviteScope[]; } - interface InviteOptions { + interface CreateInviteOptions { temporary?: boolean; maxAge?: number; maxUses?: number; @@ -3187,7 +3190,11 @@ declare module 'discord.js' { | 'gdm.join' | 'webhook.incoming'; - type GuildTemplateResolvable = string; + interface MakeErrorOptions { + name: string; + message: string; + stack: string; + } type MembershipStates = 'INVITED' | 'ACCEPTED'; @@ -3324,6 +3331,12 @@ declare module 'discord.js' { user: User; } + interface MessageMentionsHasOptions { + ignoreDirect?: boolean; + ignoreRoles?: boolean; + ignoreEveryone?: boolean; + } + interface MessageMentionOptions { parse?: MessageMentionTypes[]; roles?: Snowflake[]; @@ -3395,6 +3408,18 @@ declare module 'discord.js' { type MFALevel = keyof typeof MFALevels; + interface MultipleShardRespawnOptions { + shardDelay?: number; + respawnDelay?: number; + timeout?: number; + } + + interface MultipleShardSpawnOptions { + amount?: number | 'auto'; + delay?: number; + timeout?: number; + } + type NSFWLevel = keyof typeof NSFWLevels; interface OverwriteData { @@ -3496,17 +3521,12 @@ declare module 'discord.js' { } interface PartialChannelData { - id?: number; + id?: Snowflake | number; name: string; topic?: string; type?: ChannelType; - parentID?: number; - permissionOverwrites?: { - id: number | Snowflake; - type?: OverwriteType; - allow?: PermissionResolvable; - deny?: PermissionResolvable; - }[]; + parentID?: Snowflake | number; + permissionOverwrites?: PartialOverwriteData[]; } interface PartialGuildMember @@ -3566,8 +3586,15 @@ declare module 'discord.js' { readonly url: string; } + interface PartialOverwriteData { + id: Snowflake | number; + type?: OverwriteType; + allow?: PermissionResolvable; + deny?: PermissionResolvable; + } + interface PartialRoleData extends RoleData { - id?: number; + id?: Snowflake | number; } type PartialTypes = 'USER' | 'CHANNEL' | 'GUILD_MEMBER' | 'MESSAGE' | 'REACTION'; @@ -3640,6 +3667,21 @@ declare module 'discord.js' { premiumSubscriberRole?: true; } + interface SetChannelPositionOptions { + relative?: boolean; + reason?: string; + } + + interface SetParentOptions { + lockPermissions?: boolean; + reason?: string; + } + + interface SetRolePositionOptions { + relative?: boolean; + reason?: string; + } + type ShardingManagerMode = 'process' | 'worker'; interface ShardingManagerOptions {