mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-14 18:43:31 +01:00
refactor(*): make typedefs for all options params (#5785)
Co-authored-by: Rodry <38259440+ImRodry@users.noreply.github.com> Co-authored-by: Antonio Román <kyradiscord@gmail.com> Co-authored-by: Vlad Frangu <kingdgrizzle@gmail.com>
This commit is contained in:
@@ -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
|
* @typedef {Object} BanOptions
|
||||||
* @property {number} [days] Number of days of messages to delete, must be between 0 and 7, inclusive
|
* @property {number} [days=0] Number of days of messages to delete, must be between 0 and 7, inclusive
|
||||||
* @property {string} [reason] Reason for banning
|
* @property {string} [reason] The reason for the ban
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -59,22 +59,27 @@ class GuildChannelManager extends BaseManager {
|
|||||||
* @returns {?Snowflake}
|
* @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<Snowflake, OverwriteResolvable>} [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.
|
* Creates a new channel in the guild.
|
||||||
* @param {string} name The name of the new channel
|
* @param {string} name The name of the new channel
|
||||||
* @param {Object} [options] Options
|
* @param {GuildChannelCreateOptions} [options={}] Options for creating the new channel
|
||||||
* @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<Snowflake, OverwriteResolvable>} [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
|
|
||||||
* @returns {Promise<GuildChannel>}
|
* @returns {Promise<GuildChannel>}
|
||||||
* @example
|
* @example
|
||||||
* // Create a new text channel
|
* // Create a new text channel
|
||||||
|
|||||||
@@ -24,13 +24,18 @@ class GuildEmojiManager extends BaseGuildEmojiManager {
|
|||||||
return super.add(data, cache, { extras: [this.guild] });
|
return super.add(data, cache, { extras: [this.guild] });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Options used for creating an emoji in a guild.
|
||||||
|
* @typedef {Object} GuildEmojiCreateOptions
|
||||||
|
* @property {Collection<Snowflake, Role>|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.
|
* Creates a new custom emoji in the guild.
|
||||||
* @param {BufferResolvable|Base64Resolvable} attachment The image for the emoji
|
* @param {BufferResolvable|Base64Resolvable} attachment The image for the emoji
|
||||||
* @param {string} name The name for the emoji
|
* @param {string} name The name for the emoji
|
||||||
* @param {Object} [options] Options
|
* @param {GuildEmojiCreateOptions} [options] Options for creating the emoji
|
||||||
* @param {Collection<Snowflake, Role>|RoleResolvable[]} [options.roles] Roles to limit the emoji to
|
|
||||||
* @param {string} [options.reason] Reason for creating the emoji
|
|
||||||
* @returns {Promise<Emoji>} The created emoji
|
* @returns {Promise<Emoji>} The created emoji
|
||||||
* @example
|
* @example
|
||||||
* // Create a new emoji from a url
|
* // Create a new emoji from a url
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ class GuildManager extends BaseManager {
|
|||||||
/**
|
/**
|
||||||
* Partial data for a Role.
|
* Partial data for a Role.
|
||||||
* @typedef {Object} PartialRoleData
|
* @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
|
* this is a placeholder and will be replaced by the API after consumption
|
||||||
* @property {string} [name] The name of the role
|
* @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
|
* @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.
|
* Partial overwrite data.
|
||||||
* @typedef {Object} PartialOverwriteData
|
* @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 {string} [type] The type of this overwrite
|
||||||
* @property {PermissionResolvable} [allow] The permissions to allow
|
* @property {PermissionResolvable} [allow] The permissions to allow
|
||||||
* @property {PermissionResolvable} [deny] The permissions to deny
|
* @property {PermissionResolvable} [deny] The permissions to deny
|
||||||
@@ -72,16 +72,16 @@ class GuildManager extends BaseManager {
|
|||||||
/**
|
/**
|
||||||
* Partial data for a Channel.
|
* Partial data for a Channel.
|
||||||
* @typedef {Object} PartialChannelData
|
* @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
|
* 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} [type] The type of the channel
|
||||||
* @property {string} name The name of the channel
|
* @property {string} name The name of the channel
|
||||||
* @property {string} [topic] The topic of the text channel
|
* @property {string} [topic] The topic of the text channel
|
||||||
* @property {boolean} [nsfw] Whether the channel is NSFW
|
* @property {boolean} [nsfw] Whether the channel is NSFW
|
||||||
* @property {number} [bitrate] The bitrate of the voice channel
|
* @property {number} [bitrate] The bitrate of the voice channel
|
||||||
* @property {number} [userLimit] The user limit of the channel
|
* @property {number} [userLimit] The user limit of the channel
|
||||||
* @property {PartialOverwriteData} [permissionOverwrites]
|
* @property {PartialOverwriteData[]} [permissionOverwrites]
|
||||||
* Overwrites of the channel
|
* Overwrites of the channel
|
||||||
* @property {number} [rateLimitPerUser] The rate limit per user of the channel in seconds
|
* @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);
|
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.
|
* Creates a guild.
|
||||||
* <warn>This is only available to bots in fewer than 10 guilds.</warn>
|
* <warn>This is only available to bots in fewer than 10 guilds.</warn>
|
||||||
* @param {string} name The name of the guild
|
* @param {string} name The name of the guild
|
||||||
* @param {Object} [options] Options for the creating
|
* @param {GuildCreateOptions} [options] Options for creating the guild
|
||||||
* @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
|
|
||||||
* @returns {Promise<Guild>} The guild that was created
|
* @returns {Promise<Guild>} The guild that was created
|
||||||
*/
|
*/
|
||||||
async create(
|
async create(
|
||||||
|
|||||||
@@ -137,16 +137,16 @@ class GuildMemberManager extends BaseManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Options for searching for guild members.
|
* Options used for searching guild members.
|
||||||
* @typedef {Object} GuildSearchMembersOptions
|
* @typedef {Object} GuildSearchMembersOptions
|
||||||
* @property {string} query Filter members whose username or nickname start with this query
|
* @property {string} query Filter members whose username or nickname start with this query
|
||||||
* @property {number} [limit] Maximum number of members to search
|
* @property {number} [limit=1] Maximum number of members to search
|
||||||
* @property {boolean} [cache] Whether or not to cache the fetched member(s)
|
* @property {boolean} [cache=true] Whether or not to cache the fetched member(s)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Search for members in the guild based on a query.
|
* Searches for members in the guild based on a query.
|
||||||
* @param {GuildSearchMembersOptions} options Search options
|
* @param {GuildSearchMembersOptions} options Options for searching members
|
||||||
* @returns {Promise<Collection<Snowflake, GuildMember>>}
|
* @returns {Promise<Collection<Snowflake, GuildMember>>}
|
||||||
*/
|
*/
|
||||||
async search({ query, limit = 1, cache = true } = {}) {
|
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
|
* @typedef {Object} GuildPruneMembersOptions
|
||||||
* @property {number} [days] Number of days of inactivity required to kick
|
* @property {number} [days=7] 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} [dry=false] Get the 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 {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 {RoleResolvable[]} [roles] Array of roles to bypass the "...and no roles" constraint when pruning
|
||||||
* @property {string} [reason] Reason for this prune
|
* @property {string} [reason] Reason for this prune
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Prunes members from the guild based on how long they have been inactive.
|
* Prunes members from the guild based on how long they have been inactive.
|
||||||
* <info>It's recommended to set options.count to `false` for large guilds.</info>
|
* <info>It's recommended to set `options.count` to `false` for large guilds.</info>
|
||||||
* @param {GuildPruneMembersOptions} [options] Prune options
|
* @param {GuildPruneMembersOptions} [options] Options for pruning
|
||||||
* @returns {Promise<number|null>} The number of members that were/will be kicked
|
* @returns {Promise<number|null>} The number of members that were/will be kicked
|
||||||
* @example
|
* @example
|
||||||
* // See how many members will be pruned
|
* // See how many members will be pruned
|
||||||
|
|||||||
@@ -24,11 +24,16 @@ class ReactionUserManager extends BaseManager {
|
|||||||
* @name ReactionUserManager#cache
|
* @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.
|
* 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 {FetchReactionUsersOptions} [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
|
|
||||||
* @returns {Promise<Collection<Snowflake, User>>}
|
* @returns {Promise<Collection<Snowflake, User>>}
|
||||||
*/
|
*/
|
||||||
async fetch({ limit = 100, after } = {}) {
|
async fetch({ limit = 100, after } = {}) {
|
||||||
|
|||||||
@@ -84,17 +84,22 @@ class RoleManager extends BaseManager {
|
|||||||
* @returns {?Snowflake}
|
* @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.
|
* Creates a new role in the guild with given information.
|
||||||
* <warn>The position will silently reset to 1 if an invalid one is provided, or none.</warn>
|
* <warn>The position will silently reset to 1 if an invalid one is provided, or none.</warn>
|
||||||
* @param {Object} [options] Options
|
* @param {CreateRoleOptions} [options] Options for creating the new role
|
||||||
* @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
|
|
||||||
* @returns {Promise<Role>}
|
* @returns {Promise<Role>}
|
||||||
* @example
|
* @example
|
||||||
* // Create a new role
|
* // Create a new role
|
||||||
|
|||||||
@@ -125,13 +125,7 @@ class RequestHandler {
|
|||||||
/**
|
/**
|
||||||
* Emitted when the client hits a rate limit while making a request
|
* Emitted when the client hits a rate limit while making a request
|
||||||
* @event Client#rateLimit
|
* @event Client#rateLimit
|
||||||
* @param {Object} rateLimitInfo Object containing the rate limit info
|
* @param {RateLimitData} rateLimitData 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
|
|
||||||
*/
|
*/
|
||||||
this.manager.client.emit(RATE_LIMIT, {
|
this.manager.client.emit(RATE_LIMIT, {
|
||||||
timeout,
|
timeout,
|
||||||
@@ -232,11 +226,16 @@ class RequestHandler {
|
|||||||
invalidCount % this.manager.client.options.invalidRequestWarningInterval === 0;
|
invalidCount % this.manager.client.options.invalidRequestWarningInterval === 0;
|
||||||
if (emitInvalid) {
|
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
|
* 10k invalid requests in 10 minutes threshold that causes a ban
|
||||||
* @event Client#invalidRequestWarning
|
* @event Client#invalidRequestWarning
|
||||||
* @param {number} invalidRequestWarningInfo.count Number of invalid requests that have been made in the window
|
* @param {InvalidRequestWarningData} invalidRequestWarningData Object containing the invalid request info
|
||||||
* @param {number} invalidRequestWarningInfo.remainingTime Time in ms remaining before the count resets
|
|
||||||
*/
|
*/
|
||||||
this.manager.client.emit(INVALID_REQUEST_WARNING, {
|
this.manager.client.emit(INVALID_REQUEST_WARNING, {
|
||||||
count: invalidCount,
|
count: invalidCount,
|
||||||
|
|||||||
@@ -103,7 +103,7 @@ class Shard extends EventEmitter {
|
|||||||
* Forks a child process or creates a worker thread for the shard.
|
* Forks a child process or creates a worker thread for the shard.
|
||||||
* <warn>You should not need to call this manually.</warn>
|
* <warn>You should not need to call this manually.</warn>
|
||||||
* @param {number} [timeout=30000] The amount in milliseconds to wait until the {@link Client} has become ready
|
* @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<ChildProcess>}
|
* @returns {Promise<ChildProcess>}
|
||||||
*/
|
*/
|
||||||
async spawn(timeout = 30000) {
|
async spawn(timeout = 30000) {
|
||||||
@@ -187,13 +187,17 @@ class Shard extends EventEmitter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Kills and restarts the shard's process/worker.
|
* Options used to respawn a shard.
|
||||||
* @param {Object} [options] Respawn options for the shard
|
* @typedef {Object} ShardRespawnOptions
|
||||||
* @param {number} [options.delay=500] How long to wait between killing the process/worker and
|
* @property {number} [delay=500] How long to wait between killing the process/worker and
|
||||||
* restarting it (in milliseconds)
|
* restarting it (in milliseconds)
|
||||||
* @param {number} [options.timeout=30000] The amount in milliseconds to wait until the {@link Client}
|
* @property {number} [timeout=30000] The amount in milliseconds to wait until the {@link Client}
|
||||||
* has become ready
|
* has become ready before resolving (`-1` or `Infinity` for no wait)
|
||||||
* 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<ChildProcess>}
|
* @returns {Promise<ChildProcess>}
|
||||||
*/
|
*/
|
||||||
async respawn({ delay = 500, timeout = 30000 } = {}) {
|
async respawn({ delay = 500, timeout = 30000 } = {}) {
|
||||||
|
|||||||
@@ -163,12 +163,7 @@ class ShardClientUtil {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Requests a respawn of all shards.
|
* Requests a respawn of all shards.
|
||||||
* @param {Object} [options] Options for respawning shards
|
* @param {MultipleShardRespawnOptions} [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)
|
|
||||||
* @returns {Promise<void>} Resolves upon the message being sent
|
* @returns {Promise<void>} Resolves upon the message being sent
|
||||||
* @see {@link ShardingManager#respawnAll}
|
* @see {@link ShardingManager#respawnAll}
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -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
|
* @typedef {Object} ShardingManagerOptions
|
||||||
* @property {string|number} [totalShards='auto'] Number of total shards of all shard managers or "auto"
|
* @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"
|
* @property {string|number[]} [shardList='auto'] List of shards to spawn or "auto"
|
||||||
@@ -164,12 +164,17 @@ class ShardingManager extends EventEmitter {
|
|||||||
return shard;
|
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.
|
* Spawns multiple shards.
|
||||||
* @param {Object} [options] Options for spawning shards
|
* @param {MultipleShardSpawnOptions} [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
|
|
||||||
* @returns {Promise<Collection<number, Shard>>}
|
* @returns {Promise<Collection<number, Shard>>}
|
||||||
*/
|
*/
|
||||||
async spawn({ amount = this.totalShards, delay = 5500, timeout = 30000 } = {}) {
|
async spawn({ amount = this.totalShards, delay = 5500, timeout = 30000 } = {}) {
|
||||||
@@ -282,13 +287,18 @@ class ShardingManager extends EventEmitter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Kills all running shards and respawns them.
|
* Options used to respawn all shards.
|
||||||
* @param {Object} [options] Options for respawning shards
|
* @typedef {Object} MultipleShardRespawnOptions
|
||||||
* @param {number} [options.shardDelay=5000] How long to wait between shards (in milliseconds)
|
* @property {number} [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
|
* @property {number} [respawnDelay=500] How long to wait between killing a shard's process and restarting it
|
||||||
* (in milliseconds)
|
* (in milliseconds)
|
||||||
* @param {number} [options.timeout=30000] The amount in milliseconds to wait for a shard to become ready before
|
* @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)
|
* 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<Collection<string, Shard>>}
|
* @returns {Promise<Collection<string, Shard>>}
|
||||||
*/
|
*/
|
||||||
async respawnAll({ shardDelay = 5000, respawnDelay = 500, timeout = 30000 } = {}) {
|
async respawnAll({ shardDelay = 5000, respawnDelay = 500, timeout = 30000 } = {}) {
|
||||||
|
|||||||
@@ -22,10 +22,8 @@ class CategoryChannel extends GuildChannel {
|
|||||||
* @method setParent
|
* @method setParent
|
||||||
* @memberof CategoryChannel
|
* @memberof CategoryChannel
|
||||||
* @instance
|
* @instance
|
||||||
* @param {?GuildChannel|Snowflake} channel Parent channel
|
* @param {?(GuildChannel|Snowflake)} channel The channel to set as parent
|
||||||
* @param {Object} [options={}] Options to pass
|
* @param {SetParentOptions} [options={}] The options for setting the parent
|
||||||
* @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
|
|
||||||
* @returns {Promise<GuildChannel>}
|
* @returns {Promise<GuildChannel>}
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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.
|
* Fetches audit logs for this guild.
|
||||||
* @param {Object} [options={}] Options for fetching audit logs
|
* @param {GuildAuditLogsFetchOptions} [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
|
|
||||||
* @returns {Promise<GuildAuditLogs>}
|
* @returns {Promise<GuildAuditLogs>}
|
||||||
* @example
|
* @example
|
||||||
* // Output audit log entries
|
* // 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.
|
* Options used to add a user to a guild using OAuth2.
|
||||||
* @param {UserResolvable} user User to add to the guild
|
* @typedef {Object} AddGuildMemberOptions
|
||||||
* @param {Object} options Options for the addition
|
* @property {string} accessToken An OAuth2 access token for the user with the `guilds.join` scope granted to the
|
||||||
* @param {string} options.accessToken An OAuth2 access token for the user with the `guilds.join` scope granted to the
|
|
||||||
* bot's application
|
* bot's application
|
||||||
* @param {string} [options.nick] Nickname to give the member (requires `MANAGE_NICKNAMES`)
|
* @property {string} [nick] The nickname to give to the member (requires `MANAGE_NICKNAMES`)
|
||||||
* @param {Collection<Snowflake, Role>|RoleResolvable[]} [options.roles] Roles to add to the member
|
* @property {Collection<Snowflake, Role>|RoleResolvable[]} [roles] The roles to add to the member
|
||||||
* (requires `MANAGE_ROLES`)
|
* (requires `MANAGE_ROLES`)
|
||||||
* @param {boolean} [options.mute] Whether the member should be muted (requires `MUTE_MEMBERS`)
|
* @property {boolean} [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} [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<GuildMember>}
|
* @returns {Promise<GuildMember>}
|
||||||
*/
|
*/
|
||||||
async addMember(user, options) {
|
async addMember(user, options) {
|
||||||
|
|||||||
@@ -452,11 +452,16 @@ class GuildChannel extends Channel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the category parent of this channel.
|
* Options used to set parent of a channel.
|
||||||
* @param {?CategoryChannel|Snowflake} channel Parent channel
|
* @typedef {Object} SetParentOptions
|
||||||
* @param {Object} [options={}] Options to pass
|
* @property {boolean} [lockPermissions=true] Whether to lock the permissions to what the parent's permissions are
|
||||||
* @param {boolean} [options.lockPermissions=true] Lock the permissions to what the parent's permissions are
|
* @property {string} [reason] The reason for modifying the parent of the channel
|
||||||
* @param {string} [options.reason] Reason for modifying the parent of this 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<GuildChannel>}
|
* @returns {Promise<GuildChannel>}
|
||||||
* @example
|
* @example
|
||||||
* // Add a parent to a channel
|
* // Add a parent to a channel
|
||||||
@@ -490,12 +495,17 @@ class GuildChannel extends Channel {
|
|||||||
return this.edit({ topic }, reason);
|
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.
|
* Sets a new position for the guild channel.
|
||||||
* @param {number} position The new position for the guild channel
|
* @param {number} position The new position for the guild channel
|
||||||
* @param {Object} [options] Options for setting position
|
* @param {SetChannelPositionOptions} [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
|
|
||||||
* @returns {Promise<GuildChannel>}
|
* @returns {Promise<GuildChannel>}
|
||||||
* @example
|
* @example
|
||||||
* // Set a new channel position
|
* // Set a new channel position
|
||||||
@@ -529,19 +539,24 @@ class GuildChannel extends Channel {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates an invite to this guild channel.
|
* Options used to create an invite to a guild channel.
|
||||||
* @param {Object} [options={}] Options for the invite
|
* @typedef {Object} CreateInviteOptions
|
||||||
* @param {boolean} [options.temporary=false] Whether members that joined via the invite should be automatically
|
* @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
|
* 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)
|
* @property {number} [maxAge=86400] How long the invite should last (in seconds, 0 for forever)
|
||||||
* @param {number} [options.maxUses=0] Maximum number of uses
|
* @property {number} [maxUses=0] Maximum number of uses
|
||||||
* @param {boolean} [options.unique=false] Create a unique invite, or use an existing one with similar settings
|
* @property {boolean} [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 {UserResolvable} [targetUser] The user whose stream to display for this invite,
|
||||||
* required if `targetType` is 1, the user must be streaming in the channel
|
* 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
|
* 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
|
* @property {InviteTargetType} [targetType] The type of the target for this voice channel invite
|
||||||
* @param {string} [options.reason] Reason for creating this
|
* @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<Invite>}
|
* @returns {Promise<Invite>}
|
||||||
* @example
|
* @example
|
||||||
* // Create an invite to a channel
|
* // Create an invite to a channel
|
||||||
@@ -591,22 +606,15 @@ class GuildChannel extends Channel {
|
|||||||
return invites;
|
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.
|
* Clones this channel.
|
||||||
* @param {Object} [options] The options
|
* @param {GuildChannelCloneOptions} [options] The options for cloning this channel
|
||||||
* @param {string} [options.name=this.name] Name of the new channel
|
|
||||||
* @param {OverwriteResolvable[]|Collection<Snowflake, OverwriteResolvable>} [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
|
|
||||||
* @returns {Promise<GuildChannel>}
|
* @returns {Promise<GuildChannel>}
|
||||||
*/
|
*/
|
||||||
clone(options = {}) {
|
clone(options = {}) {
|
||||||
@@ -624,7 +632,6 @@ class GuildChannel extends Channel {
|
|||||||
...options,
|
...options,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
/* eslint-enable max-len */
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if this channel has the same type, topic, position, name, overwrites and ID as another channel.
|
* Checks if this channel has the same type, topic, position, name, overwrites and ID as another channel.
|
||||||
|
|||||||
@@ -323,9 +323,7 @@ class GuildMember extends Base {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Bans this guild member.
|
* Bans this guild member.
|
||||||
* @param {Object} [options] Options for the ban
|
* @param {BanOptions} [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
|
|
||||||
* @returns {Promise<GuildMember>}
|
* @returns {Promise<GuildMember>}
|
||||||
* @example
|
* @example
|
||||||
* // ban a guild member
|
* // ban a guild member
|
||||||
|
|||||||
@@ -136,10 +136,15 @@ class GuildTemplate extends Base {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Updates the metadata on this template.
|
* Options used to edit a guild template.
|
||||||
* @param {Object} options Options for the template
|
* @typedef {Object} EditGuildTemplateOptions
|
||||||
* @param {string} [options.name] The name of this template
|
* @property {string} [name] The name of this template
|
||||||
* @param {string} [options.description] The description 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<GuildTemplate>}
|
* @returns {Promise<GuildTemplate>}
|
||||||
*/
|
*/
|
||||||
edit({ name, description } = {}) {
|
edit({ name, description } = {}) {
|
||||||
|
|||||||
@@ -83,7 +83,7 @@ class MessageComponentInteractionCollector extends Collector {
|
|||||||
/**
|
/**
|
||||||
* Handles an incoming interaction for possible collection.
|
* Handles an incoming interaction for possible collection.
|
||||||
* @param {Interaction} interaction The interaction to possibly collect
|
* @param {Interaction} interaction The interaction to possibly collect
|
||||||
* @returns {?Snowflake|string}
|
* @returns {?(Snowflake|string)}
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
collect(interaction) {
|
collect(interaction) {
|
||||||
|
|||||||
@@ -161,14 +161,19 @@ class MessageMentions {
|
|||||||
return this._channels;
|
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.
|
* Checks if a user, guild member, role, or channel is mentioned.
|
||||||
* Takes into account user mentions, role mentions, and @everyone/@here mentions.
|
* Takes into account user mentions, role mentions, and `@everyone`/`@here` mentions.
|
||||||
* @param {UserResolvable|RoleResolvable|ChannelResolvable} data User/Role/Channel to check
|
* @param {UserResolvable|RoleResolvable|ChannelResolvable} data The User/Role/Channel to check for
|
||||||
* @param {Object} [options] Options
|
* @param {MessageMentionsHasOptions} [options] The options for the check
|
||||||
* @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
|
|
||||||
* @returns {boolean}
|
* @returns {boolean}
|
||||||
*/
|
*/
|
||||||
has(data, { ignoreDirect = false, ignoreRoles = false, ignoreEveryone = false } = {}) {
|
has(data, { ignoreDirect = false, ignoreRoles = false, ignoreEveryone = false } = {}) {
|
||||||
|
|||||||
@@ -82,7 +82,7 @@ class ReactionCollector extends Collector {
|
|||||||
* Handles an incoming reaction for possible collection.
|
* Handles an incoming reaction for possible collection.
|
||||||
* @param {MessageReaction} reaction The reaction to possibly collect
|
* @param {MessageReaction} reaction The reaction to possibly collect
|
||||||
* @param {User} user The user that added the reaction
|
* @param {User} user The user that added the reaction
|
||||||
* @returns {?Snowflake|string}
|
* @returns {?(Snowflake|string)}
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
collect(reaction, user) {
|
collect(reaction, user) {
|
||||||
@@ -113,7 +113,7 @@ class ReactionCollector extends Collector {
|
|||||||
* Handles a reaction deletion for possible disposal.
|
* Handles a reaction deletion for possible disposal.
|
||||||
* @param {MessageReaction} reaction The reaction to possibly dispose of
|
* @param {MessageReaction} reaction The reaction to possibly dispose of
|
||||||
* @param {User} user The user that removed the reaction
|
* @param {User} user The user that removed the reaction
|
||||||
* @returns {?Snowflake|string}
|
* @returns {?(Snowflake|string)}
|
||||||
*/
|
*/
|
||||||
dispose(reaction, user) {
|
dispose(reaction, user) {
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -323,11 +323,16 @@ class Role extends Base {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the position of the role.
|
* Options used to set position of a role.
|
||||||
* @param {number} position The position of the role
|
* @typedef {Object} SetRolePositionOptions
|
||||||
* @param {Object} [options] Options for setting position
|
* @property {boolean} [relative=false] Whether to change the position relative to its current value or not
|
||||||
* @param {boolean} [options.relative=false] Change the position relative to its current value
|
* @property {string} [reason] The reason for changing the position
|
||||||
* @param {string} [options.reason] 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<Role>}
|
* @returns {Promise<Role>}
|
||||||
* @example
|
* @example
|
||||||
* // Set the position of the role
|
* // Set the position of the role
|
||||||
|
|||||||
@@ -194,10 +194,16 @@ class Collector extends EventEmitter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Resets the collectors timeout and idle timer.
|
* Options used to reset timeout and idle timer of a {@link Collector}.
|
||||||
* @param {Object} [options] Options
|
* @typedef {Object} CollectorResetTimerOptions
|
||||||
* @param {number} [options.time] How long to run the collector for in milliseconds
|
* @property {number} [time] How long to run the collector for (in milliseconds)
|
||||||
* @param {number} [options.idle] How long to stop the collector after inactivity 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 } = {}) {
|
resetTimer({ time, idle } = {}) {
|
||||||
if (this._timeout) {
|
if (this._timeout) {
|
||||||
|
|||||||
@@ -90,19 +90,24 @@ class Util {
|
|||||||
return messages.concat(msg).filter(m => m);
|
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.
|
* Escapes any Discord-flavour markdown in a string.
|
||||||
* @param {string} text Content to escape
|
* @param {string} text Content to escape
|
||||||
* @param {Object} [options={}] What types of markdown to escape
|
* @param {EscapeMarkdownOptions} [options={}] Options for escaping the markdown
|
||||||
* @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
|
|
||||||
* @returns {string}
|
* @returns {string}
|
||||||
*/
|
*/
|
||||||
static escapeMarkdown(
|
static escapeMarkdown(
|
||||||
@@ -323,12 +328,17 @@ class Util {
|
|||||||
return given;
|
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.
|
* Makes an Error from a plain info object.
|
||||||
* @param {Object} obj Error info
|
* @param {MakeErrorOptions} 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
|
|
||||||
* @returns {Error}
|
* @returns {Error}
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
@@ -342,7 +352,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
|
* @param {Error} err Error to get info from
|
||||||
* @returns {Object}
|
* @returns {MakeErrorOptions}
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
static makePlainError(err) {
|
static makePlainError(err) {
|
||||||
|
|||||||
150
typings/index.d.ts
vendored
150
typings/index.d.ts
vendored
@@ -422,7 +422,7 @@ declare module 'discord.js' {
|
|||||||
public handleCollect(...args: any[]): void;
|
public handleCollect(...args: any[]): void;
|
||||||
public handleDispose(...args: any[]): void;
|
public handleDispose(...args: any[]): void;
|
||||||
public stop(reason?: string): void;
|
public stop(reason?: string): void;
|
||||||
public resetTimer(options?: { time?: number; idle?: number }): void;
|
public resetTimer(options?: CollectorResetTimerOptions): void;
|
||||||
public [Symbol.asyncIterator](): AsyncIterableIterator<V>;
|
public [Symbol.asyncIterator](): AsyncIterableIterator<V>;
|
||||||
public toJSON(): unknown;
|
public toJSON(): unknown;
|
||||||
|
|
||||||
@@ -890,7 +890,7 @@ declare module 'discord.js' {
|
|||||||
public type: Exclude<keyof typeof ChannelType, 'dm' | 'group' | 'unknown'>;
|
public type: Exclude<keyof typeof ChannelType, 'dm' | 'group' | 'unknown'>;
|
||||||
public readonly viewable: boolean;
|
public readonly viewable: boolean;
|
||||||
public clone(options?: GuildChannelCloneOptions): Promise<this>;
|
public clone(options?: GuildChannelCloneOptions): Promise<this>;
|
||||||
public createInvite(options?: InviteOptions): Promise<Invite>;
|
public createInvite(options?: CreateInviteOptions): Promise<Invite>;
|
||||||
public createOverwrite(
|
public createOverwrite(
|
||||||
userOrRole: RoleResolvable | UserResolvable,
|
userOrRole: RoleResolvable | UserResolvable,
|
||||||
options: PermissionOverwriteOptions,
|
options: PermissionOverwriteOptions,
|
||||||
@@ -907,11 +907,8 @@ declare module 'discord.js' {
|
|||||||
public permissionsFor(memberOrRole: GuildMember | Role): Readonly<Permissions>;
|
public permissionsFor(memberOrRole: GuildMember | Role): Readonly<Permissions>;
|
||||||
public permissionsFor(memberOrRole: GuildMemberResolvable | RoleResolvable): Readonly<Permissions> | null;
|
public permissionsFor(memberOrRole: GuildMemberResolvable | RoleResolvable): Readonly<Permissions> | null;
|
||||||
public setName(name: string, reason?: string): Promise<this>;
|
public setName(name: string, reason?: string): Promise<this>;
|
||||||
public setParent(
|
public setParent(channel: CategoryChannel | Snowflake | null, options?: SetParentOptions): Promise<this>;
|
||||||
channel: CategoryChannel | Snowflake | null,
|
public setPosition(position: number, options?: SetChannelPositionOptions): Promise<this>;
|
||||||
options?: { lockPermissions?: boolean; reason?: string },
|
|
||||||
): Promise<this>;
|
|
||||||
public setPosition(position: number, options?: { relative?: boolean; reason?: string }): Promise<this>;
|
|
||||||
public setTopic(topic: string | null, reason?: string): Promise<this>;
|
public setTopic(topic: string | null, reason?: string): Promise<this>;
|
||||||
public updateOverwrite(
|
public updateOverwrite(
|
||||||
userOrRole: RoleResolvable | UserResolvable,
|
userOrRole: RoleResolvable | UserResolvable,
|
||||||
@@ -1013,7 +1010,7 @@ declare module 'discord.js' {
|
|||||||
public unSynced: boolean | null;
|
public unSynced: boolean | null;
|
||||||
public createGuild(name: string, icon?: BufferResolvable | Base64Resolvable): Promise<Guild>;
|
public createGuild(name: string, icon?: BufferResolvable | Base64Resolvable): Promise<Guild>;
|
||||||
public delete(): Promise<GuildTemplate>;
|
public delete(): Promise<GuildTemplate>;
|
||||||
public edit(options?: { name?: string; description?: string }): Promise<GuildTemplate>;
|
public edit(options?: EditGuildTemplateOptions): Promise<GuildTemplate>;
|
||||||
public sync(): Promise<GuildTemplate>;
|
public sync(): Promise<GuildTemplate>;
|
||||||
public static GUILD_TEMPLATES_PATTERN: RegExp;
|
public static GUILD_TEMPLATES_PATTERN: RegExp;
|
||||||
}
|
}
|
||||||
@@ -1398,14 +1395,7 @@ declare module 'discord.js' {
|
|||||||
public readonly client: Client;
|
public readonly client: Client;
|
||||||
public everyone: boolean;
|
public everyone: boolean;
|
||||||
public readonly guild: Guild;
|
public readonly guild: Guild;
|
||||||
public has(
|
public has(data: UserResolvable | RoleResolvable | ChannelResolvable, options?: MessageMentionsHasOptions): boolean;
|
||||||
data: UserResolvable | RoleResolvable | ChannelResolvable,
|
|
||||||
options?: {
|
|
||||||
ignoreDirect?: boolean;
|
|
||||||
ignoreRoles?: boolean;
|
|
||||||
ignoreEveryone?: boolean;
|
|
||||||
},
|
|
||||||
): boolean;
|
|
||||||
public readonly members: Collection<Snowflake, GuildMember> | null;
|
public readonly members: Collection<Snowflake, GuildMember> | null;
|
||||||
public roles: Collection<Snowflake, Role>;
|
public roles: Collection<Snowflake, Role>;
|
||||||
public users: Collection<Snowflake, User>;
|
public users: Collection<Snowflake, User>;
|
||||||
@@ -1583,7 +1573,7 @@ declare module 'discord.js' {
|
|||||||
public setMentionable(mentionable: boolean, reason?: string): Promise<Role>;
|
public setMentionable(mentionable: boolean, reason?: string): Promise<Role>;
|
||||||
public setName(name: string, reason?: string): Promise<Role>;
|
public setName(name: string, reason?: string): Promise<Role>;
|
||||||
public setPermissions(permissions: PermissionResolvable, reason?: string): Promise<Role>;
|
public setPermissions(permissions: PermissionResolvable, reason?: string): Promise<Role>;
|
||||||
public setPosition(position: number, options?: { relative?: boolean; reason?: string }): Promise<Role>;
|
public setPosition(position: number, options?: SetRolePositionOptions): Promise<Role>;
|
||||||
public toJSON(): unknown;
|
public toJSON(): unknown;
|
||||||
public toString(): string;
|
public toString(): string;
|
||||||
|
|
||||||
@@ -1646,7 +1636,7 @@ declare module 'discord.js' {
|
|||||||
): Promise<T>;
|
): Promise<T>;
|
||||||
public fetchClientValues(prop: string): Promise<any[]>;
|
public fetchClientValues(prop: string): Promise<any[]>;
|
||||||
public fetchClientValues(prop: string, shard: number): Promise<any>;
|
public fetchClientValues(prop: string, shard: number): Promise<any>;
|
||||||
public respawnAll(options?: { shardDelay?: number; respawnDelay?: number; timeout?: number }): Promise<void>;
|
public respawnAll(options?: MultipleShardRespawnOptions): Promise<void>;
|
||||||
public send(message: any): Promise<void>;
|
public send(message: any): Promise<void>;
|
||||||
|
|
||||||
public static singleton(client: Client, mode: ShardingManagerMode): ShardClientUtil;
|
public static singleton(client: Client, mode: ShardingManagerMode): ShardClientUtil;
|
||||||
@@ -1676,16 +1666,8 @@ declare module 'discord.js' {
|
|||||||
public createShard(id: number): Shard;
|
public createShard(id: number): Shard;
|
||||||
public fetchClientValues(prop: string): Promise<any[]>;
|
public fetchClientValues(prop: string): Promise<any[]>;
|
||||||
public fetchClientValues(prop: string, shard: number): Promise<any>;
|
public fetchClientValues(prop: string, shard: number): Promise<any>;
|
||||||
public respawnAll(options?: {
|
public respawnAll(options?: MultipleShardRespawnOptions): Promise<Collection<number, Shard>>;
|
||||||
shardDelay?: number;
|
public spawn(options?: MultipleShardSpawnOptions): Promise<Collection<number, Shard>>;
|
||||||
respawnDelay?: number;
|
|
||||||
timeout?: number;
|
|
||||||
}): Promise<Collection<number, Shard>>;
|
|
||||||
public spawn(options?: {
|
|
||||||
amount?: number | 'auto';
|
|
||||||
delay?: number;
|
|
||||||
timeout?: number;
|
|
||||||
}): Promise<Collection<number, Shard>>;
|
|
||||||
|
|
||||||
public on(event: 'shardCreate', listener: (shard: Shard) => Awaited<void>): this;
|
public on(event: 'shardCreate', listener: (shard: Shard) => Awaited<void>): this;
|
||||||
|
|
||||||
@@ -1826,8 +1808,8 @@ declare module 'discord.js' {
|
|||||||
public static fetchRecommendedShards(token: string, guildsPerShard?: number): Promise<number>;
|
public static fetchRecommendedShards(token: string, guildsPerShard?: number): Promise<number>;
|
||||||
public static flatten(obj: unknown, ...props: { [key: string]: boolean | string }[]): unknown;
|
public static flatten(obj: unknown, ...props: { [key: string]: boolean | string }[]): unknown;
|
||||||
public static idToBinary(num: Snowflake): string;
|
public static idToBinary(num: Snowflake): string;
|
||||||
public static makeError(obj: { name: string; message: string; stack: string }): Error;
|
public static makeError(obj: MakeErrorOptions): Error;
|
||||||
public static makePlainError(err: Error): { name: string; message: string; stack: string };
|
public static makePlainError(err: Error): MakeErrorOptions;
|
||||||
public static mergeDefault(def: unknown, given: unknown): unknown;
|
public static mergeDefault(def: unknown, given: unknown): unknown;
|
||||||
public static moveElementInArray(array: any[], element: any, newIndex: number, offset?: boolean): number;
|
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;
|
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<Snowflake, GuildChannel, GuildChannelResolvable> {
|
export class GuildChannelManager extends BaseManager<Snowflake, GuildChannel, GuildChannelResolvable> {
|
||||||
constructor(guild: Guild, iterable?: Iterable<any>);
|
constructor(guild: Guild, iterable?: Iterable<any>);
|
||||||
public guild: Guild;
|
public guild: Guild;
|
||||||
public create(name: string, options: GuildCreateChannelOptions & { type: 'voice' }): Promise<VoiceChannel>;
|
public create(name: string, options: GuildChannelCreateOptions & { type: 'voice' }): Promise<VoiceChannel>;
|
||||||
public create(name: string, options: GuildCreateChannelOptions & { type: 'category' }): Promise<CategoryChannel>;
|
public create(name: string, options: GuildChannelCreateOptions & { type: 'category' }): Promise<CategoryChannel>;
|
||||||
public create(name: string, options?: GuildCreateChannelOptions & { type?: 'text' }): Promise<TextChannel>;
|
public create(name: string, options?: GuildChannelCreateOptions & { type?: 'text' }): Promise<TextChannel>;
|
||||||
public create(name: string, options: GuildCreateChannelOptions & { type: 'news' }): Promise<NewsChannel>;
|
public create(name: string, options: GuildChannelCreateOptions & { type: 'news' }): Promise<NewsChannel>;
|
||||||
public create(name: string, options: GuildCreateChannelOptions & { type: 'store' }): Promise<StoreChannel>;
|
public create(name: string, options: GuildChannelCreateOptions & { type: 'store' }): Promise<StoreChannel>;
|
||||||
public create(name: string, options: GuildCreateChannelOptions & { type: 'stage' }): Promise<StageChannel>;
|
public create(name: string, options: GuildChannelCreateOptions & { type: 'stage' }): Promise<StageChannel>;
|
||||||
public create(
|
public create(
|
||||||
name: string,
|
name: string,
|
||||||
options: GuildCreateChannelOptions,
|
options: GuildChannelCreateOptions,
|
||||||
): Promise<TextChannel | VoiceChannel | CategoryChannel | NewsChannel | StoreChannel | StageChannel>;
|
): Promise<TextChannel | VoiceChannel | CategoryChannel | NewsChannel | StoreChannel | StageChannel>;
|
||||||
public fetch(
|
public fetch(
|
||||||
id: Snowflake,
|
id: Snowflake,
|
||||||
@@ -2267,7 +2249,7 @@ declare module 'discord.js' {
|
|||||||
export class ReactionUserManager extends BaseManager<Snowflake, User, UserResolvable> {
|
export class ReactionUserManager extends BaseManager<Snowflake, User, UserResolvable> {
|
||||||
constructor(client: Client, iterable: Iterable<any> | undefined, reaction: MessageReaction);
|
constructor(client: Client, iterable: Iterable<any> | undefined, reaction: MessageReaction);
|
||||||
public reaction: MessageReaction;
|
public reaction: MessageReaction;
|
||||||
public fetch(options?: { limit?: number; after?: Snowflake }): Promise<Collection<Snowflake, User>>;
|
public fetch(options?: FetchReactionUsersOptions): Promise<Collection<Snowflake, User>>;
|
||||||
public remove(user?: UserResolvable): Promise<MessageReaction>;
|
public remove(user?: UserResolvable): Promise<MessageReaction>;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2278,9 +2260,9 @@ declare module 'discord.js' {
|
|||||||
public guild: Guild;
|
public guild: Guild;
|
||||||
public readonly premiumSubscriberRole: Role | null;
|
public readonly premiumSubscriberRole: Role | null;
|
||||||
public botRoleFor(user: UserResolvable): Role | null;
|
public botRoleFor(user: UserResolvable): Role | null;
|
||||||
public create(options?: RoleData & { reason?: string }): Promise<Role>;
|
|
||||||
public fetch(id: Snowflake, options?: BaseFetchOptions): Promise<Role | null>;
|
public fetch(id: Snowflake, options?: BaseFetchOptions): Promise<Role | null>;
|
||||||
public fetch(id?: Snowflake, options?: BaseFetchOptions): Promise<Collection<Snowflake, Role>>;
|
public fetch(id?: Snowflake, options?: BaseFetchOptions): Promise<Collection<Snowflake, Role>>;
|
||||||
|
public create(options?: CreateRoleOptions): Promise<Role>;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class UserManager extends BaseManager<Snowflake, User, UserResolvable> {
|
export class UserManager extends BaseManager<Snowflake, User, UserResolvable> {
|
||||||
@@ -2717,6 +2699,11 @@ declare module 'discord.js' {
|
|||||||
dispose?: boolean;
|
dispose?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
interface CollectorResetTimerOptions {
|
||||||
|
time?: number;
|
||||||
|
idle?: number;
|
||||||
|
}
|
||||||
|
|
||||||
type ColorResolvable =
|
type ColorResolvable =
|
||||||
| 'DEFAULT'
|
| 'DEFAULT'
|
||||||
| 'WHITE'
|
| 'WHITE'
|
||||||
@@ -2764,6 +2751,10 @@ declare module 'discord.js' {
|
|||||||
role?: Role | RawRole;
|
role?: Role | RawRole;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
interface CreateRoleOptions extends RoleData {
|
||||||
|
reason?: string;
|
||||||
|
}
|
||||||
|
|
||||||
interface CrosspostedChannel {
|
interface CrosspostedChannel {
|
||||||
channelID: Snowflake;
|
channelID: Snowflake;
|
||||||
guildID: Snowflake;
|
guildID: Snowflake;
|
||||||
@@ -2782,6 +2773,11 @@ declare module 'discord.js' {
|
|||||||
|
|
||||||
type DefaultMessageNotifications = 'ALL' | 'MENTIONS';
|
type DefaultMessageNotifications = 'ALL' | 'MENTIONS';
|
||||||
|
|
||||||
|
interface EditGuildTemplateOptions {
|
||||||
|
name?: string;
|
||||||
|
description?: string;
|
||||||
|
}
|
||||||
|
|
||||||
interface EmbedField {
|
interface EmbedField {
|
||||||
name: string;
|
name: string;
|
||||||
value: string;
|
value: string;
|
||||||
@@ -2877,6 +2873,11 @@ declare module 'discord.js' {
|
|||||||
|
|
||||||
type FetchOwnerOptions = Omit<FetchMemberOptions, 'user'>;
|
type FetchOwnerOptions = Omit<FetchMemberOptions, 'user'>;
|
||||||
|
|
||||||
|
interface FetchReactionUsersOptions {
|
||||||
|
limit?: number;
|
||||||
|
after?: Snowflake;
|
||||||
|
}
|
||||||
|
|
||||||
interface FileOptions {
|
interface FileOptions {
|
||||||
attachment: BufferResolvable | Stream;
|
attachment: BufferResolvable | Stream;
|
||||||
name?: string;
|
name?: string;
|
||||||
@@ -2962,7 +2963,7 @@ declare module 'discord.js' {
|
|||||||
|
|
||||||
type GuildChannelResolvable = Snowflake | GuildChannel;
|
type GuildChannelResolvable = Snowflake | GuildChannel;
|
||||||
|
|
||||||
interface GuildCreateChannelOptions {
|
interface GuildChannelCreateOptions {
|
||||||
permissionOverwrites?: OverwriteResolvable[] | Collection<Snowflake, OverwriteResolvable>;
|
permissionOverwrites?: OverwriteResolvable[] | Collection<Snowflake, OverwriteResolvable>;
|
||||||
topic?: string;
|
topic?: string;
|
||||||
type?: Exclude<
|
type?: Exclude<
|
||||||
@@ -2978,12 +2979,12 @@ declare module 'discord.js' {
|
|||||||
reason?: string;
|
reason?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface GuildChannelCloneOptions extends GuildCreateChannelOptions {
|
interface GuildChannelCloneOptions extends GuildChannelCreateOptions {
|
||||||
name?: string;
|
name?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface GuildCreateOptions {
|
interface GuildCreateOptions {
|
||||||
afkChannelID?: number;
|
afkChannelID?: Snowflake | number;
|
||||||
afkTimeout?: number;
|
afkTimeout?: number;
|
||||||
channels?: PartialChannelData[];
|
channels?: PartialChannelData[];
|
||||||
defaultMessageNotifications?: DefaultMessageNotifications | number;
|
defaultMessageNotifications?: DefaultMessageNotifications | number;
|
||||||
@@ -2991,7 +2992,7 @@ declare module 'discord.js' {
|
|||||||
icon?: BufferResolvable | Base64Resolvable | null;
|
icon?: BufferResolvable | Base64Resolvable | null;
|
||||||
roles?: PartialRoleData[];
|
roles?: PartialRoleData[];
|
||||||
systemChannelFlags?: SystemChannelFlagsResolvable;
|
systemChannelFlags?: SystemChannelFlagsResolvable;
|
||||||
systemChannelID?: number;
|
systemChannelID?: Snowflake | number;
|
||||||
verificationLevel?: VerificationLevel | number;
|
verificationLevel?: VerificationLevel | number;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3083,6 +3084,8 @@ declare module 'discord.js' {
|
|||||||
cache?: boolean;
|
cache?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type GuildTemplateResolvable = string;
|
||||||
|
|
||||||
interface HTTPAttachmentData {
|
interface HTTPAttachmentData {
|
||||||
attachment: string | Buffer | Stream;
|
attachment: string | Buffer | Stream;
|
||||||
name: string;
|
name: string;
|
||||||
@@ -3161,7 +3164,7 @@ declare module 'discord.js' {
|
|||||||
additionalScopes?: InviteScope[];
|
additionalScopes?: InviteScope[];
|
||||||
}
|
}
|
||||||
|
|
||||||
interface InviteOptions {
|
interface CreateInviteOptions {
|
||||||
temporary?: boolean;
|
temporary?: boolean;
|
||||||
maxAge?: number;
|
maxAge?: number;
|
||||||
maxUses?: number;
|
maxUses?: number;
|
||||||
@@ -3187,7 +3190,11 @@ declare module 'discord.js' {
|
|||||||
| 'gdm.join'
|
| 'gdm.join'
|
||||||
| 'webhook.incoming';
|
| 'webhook.incoming';
|
||||||
|
|
||||||
type GuildTemplateResolvable = string;
|
interface MakeErrorOptions {
|
||||||
|
name: string;
|
||||||
|
message: string;
|
||||||
|
stack: string;
|
||||||
|
}
|
||||||
|
|
||||||
type MembershipStates = 'INVITED' | 'ACCEPTED';
|
type MembershipStates = 'INVITED' | 'ACCEPTED';
|
||||||
|
|
||||||
@@ -3324,6 +3331,12 @@ declare module 'discord.js' {
|
|||||||
user: User;
|
user: User;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
interface MessageMentionsHasOptions {
|
||||||
|
ignoreDirect?: boolean;
|
||||||
|
ignoreRoles?: boolean;
|
||||||
|
ignoreEveryone?: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
interface MessageMentionOptions {
|
interface MessageMentionOptions {
|
||||||
parse?: MessageMentionTypes[];
|
parse?: MessageMentionTypes[];
|
||||||
roles?: Snowflake[];
|
roles?: Snowflake[];
|
||||||
@@ -3395,6 +3408,18 @@ declare module 'discord.js' {
|
|||||||
|
|
||||||
type MFALevel = keyof typeof MFALevels;
|
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;
|
type NSFWLevel = keyof typeof NSFWLevels;
|
||||||
|
|
||||||
interface OverwriteData {
|
interface OverwriteData {
|
||||||
@@ -3496,17 +3521,12 @@ declare module 'discord.js' {
|
|||||||
}
|
}
|
||||||
|
|
||||||
interface PartialChannelData {
|
interface PartialChannelData {
|
||||||
id?: number;
|
id?: Snowflake | number;
|
||||||
name: string;
|
name: string;
|
||||||
topic?: string;
|
topic?: string;
|
||||||
type?: ChannelType;
|
type?: ChannelType;
|
||||||
parentID?: number;
|
parentID?: Snowflake | number;
|
||||||
permissionOverwrites?: {
|
permissionOverwrites?: PartialOverwriteData[];
|
||||||
id: number | Snowflake;
|
|
||||||
type?: OverwriteType;
|
|
||||||
allow?: PermissionResolvable;
|
|
||||||
deny?: PermissionResolvable;
|
|
||||||
}[];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
interface PartialGuildMember
|
interface PartialGuildMember
|
||||||
@@ -3566,8 +3586,15 @@ declare module 'discord.js' {
|
|||||||
readonly url: string;
|
readonly url: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
interface PartialOverwriteData {
|
||||||
|
id: Snowflake | number;
|
||||||
|
type?: OverwriteType;
|
||||||
|
allow?: PermissionResolvable;
|
||||||
|
deny?: PermissionResolvable;
|
||||||
|
}
|
||||||
|
|
||||||
interface PartialRoleData extends RoleData {
|
interface PartialRoleData extends RoleData {
|
||||||
id?: number;
|
id?: Snowflake | number;
|
||||||
}
|
}
|
||||||
|
|
||||||
type PartialTypes = 'USER' | 'CHANNEL' | 'GUILD_MEMBER' | 'MESSAGE' | 'REACTION';
|
type PartialTypes = 'USER' | 'CHANNEL' | 'GUILD_MEMBER' | 'MESSAGE' | 'REACTION';
|
||||||
@@ -3640,6 +3667,21 @@ declare module 'discord.js' {
|
|||||||
premiumSubscriberRole?: true;
|
premiumSubscriberRole?: true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
interface SetChannelPositionOptions {
|
||||||
|
relative?: boolean;
|
||||||
|
reason?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface SetParentOptions {
|
||||||
|
lockPermissions?: boolean;
|
||||||
|
reason?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface SetRolePositionOptions {
|
||||||
|
relative?: boolean;
|
||||||
|
reason?: string;
|
||||||
|
}
|
||||||
|
|
||||||
type ShardingManagerMode = 'process' | 'worker';
|
type ShardingManagerMode = 'process' | 'worker';
|
||||||
|
|
||||||
interface ShardingManagerOptions {
|
interface ShardingManagerOptions {
|
||||||
|
|||||||
Reference in New Issue
Block a user