Skip to content

Commit

Permalink
docs(GuildMemberManager): fix docs for #search() (#5784)
Browse files Browse the repository at this point in the history
  • Loading branch information
vaporoxx committed Jun 9, 2021
1 parent e798fb7 commit 0139e10
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 16 deletions.
11 changes: 8 additions & 3 deletions src/managers/GuildBanManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,12 +120,17 @@ class GuildBanManager extends BaseManager {
return data.reduce((col, ban) => col.set(ban.user.id, this.add(ban, cache)), new Collection());
}

/**
* Options for banning a user.
* @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
*/

/**
* Bans a user from the guild.
* @param {UserResolvable} user The user to ban
* @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<GuildMember|User|Snowflake>} Result object will be resolved as specifically as possible.
* If the GuildMember cannot be resolved, the User will instead be attempted to be resolved. If that also cannot
* be resolved, the user ID will be the result.
Expand Down
34 changes: 21 additions & 13 deletions src/managers/GuildMemberManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,12 +138,17 @@ class GuildMemberManager extends BaseManager {
return this._fetchMany(options);
}

/**
* Options for searching for 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)
*/

/**
* Search for members in the guild based on a query.
* @param {Object} options Search options
* @property {string} options.query Filter members whose username or nickname start with this query
* @property {number} [options.limit=1] Maximum number of members to search
* @property {boolean} [options.cache=true] Whether or not to cache the fetched member(s)
* @param {GuildSearchMembersOptions} options Search options
* @returns {Promise<Collection<Snowflake, GuildMember>>}
*/
async search({ query, limit = 1, cache = true } = {}) {
Expand Down Expand Up @@ -192,15 +197,20 @@ class GuildMemberManager extends BaseManager {
return clone ?? this.add(d, false);
}

/**
* Options 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 {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.
* <info>It's recommended to set options.count to `false` for large guilds.</info>
* @param {Object} [options] Prune options
* @param {number} [options.days=7] Number of days of inactivity required to kick
* @param {boolean} [options.dry=false] Get number of users that will be kicked, without actually kicking them
* @param {boolean} [options.count=true] Whether or not to return the number of users that have been kicked.
* @param {RoleResolvable[]} [options.roles=[]] Array of roles to bypass the "...and no roles" constraint when pruning
* @param {string} [options.reason] Reason for this prune
* @param {GuildPruneMembersOptions} [options] Prune options
* @returns {Promise<number|null>} The number of members that were/will be kicked
* @example
* // See how many members will be pruned
Expand Down Expand Up @@ -276,9 +286,7 @@ class GuildMemberManager extends BaseManager {
/**
* Bans a user from the guild.
* @param {UserResolvable} user The user to ban
* @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<GuildMember|User|Snowflake>} Result object will be resolved as specifically as possible.
* If the GuildMember cannot be resolved, the User will instead be attempted to be resolved. If that also cannot
* be resolved, the user ID will be the result.
Expand Down

0 comments on commit 0139e10

Please sign in to comment.