GuildMemberManager

export class GuildMemberManager extends CachedManager<Snowflake, GuildMember, GuildMemberResolvable>
export class GuildMemberManager extends CachedManager<Snowflake, GuildMember, GuildMemberResolvable>
Manages API methods for GuildMembers and stores their cache.
Readonly
cache:Collection<K, Holds>
The cache of items for this manager.
Inherited from DataManager
Readonly
client:Client
The client that instantiated this Manager
Inherited from BaseManager
guild:Guild
The guild this manager belongs to
Readonly
holds:Constructable<Holds>
The data structure belonging to this manager.
Inherited from DataManager
Readonly
me:GuildMember | null
The client user as a GuildMember of this guild
add(user, options):Promise<GuildMember | null>
Adds a user to the guild using OAuth2. This method requires the permission.
NameTypeOptionalDescription
userUserResolvableNoThe user to add to the guild
optionsAddGuildMemberOptions & { fetchWhenExisting: false }NoOptions for adding the user to the guild
addRole(options):Promise<GuildMember | User | Snowflake>
Adds a role to a member.
NameTypeOptionalDescription
optionsAddOrRemoveGuildMemberRoleOptionsNoOptions for adding the role
ban(user, options?):Promise<GuildMember | User | Snowflake>
Bans a user from the guild.
Returns
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. Internally calls the GuildBanManager#create method.
NameTypeOptionalDescription
userUserResolvableNoThe user to ban
optionsBanOptionsYesOptions for the ban
edit(user, options):Promise<GuildMember>
Edits a member of the guild. The user must be a member of the guild
NameTypeOptionalDescription
userUserResolvableNoThe member to edit
optionsGuildMemberEditOptionsNoThe options to provide
fetch(options):Promise<GuildMember>
Fetches member(s) from a guild.
NameTypeOptionalDescription
optionsUserResolvable | FetchMemberOptions | (FetchMembersOptions & { user: UserResolvable })NoOptions for fetching member(s). Omitting the parameter or providing undefined will fetch all members.
fetchMe(options?):Promise<GuildMember>
Fetches the client user as a GuildMember of the guild.
NameTypeOptionalDescription
optionsBaseFetchOptionsYesThe options for fetching the member
kick(user, reason?):Promise<GuildMember | User | Snowflake>
Kicks a user from the guild. The user must be a member of the guild
Returns
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's id will be the result.
NameTypeOptionalDescription
userUserResolvableNoThe member to kick
reasonstringYesReason for kicking
list(options?):Promise<Collection<Snowflake, GuildMember>>
Lists up to 1000 members of the guild.
NameTypeOptionalDescription
optionsGuildListMembersOptionsYesOptions for listing members
prune(options):Promise<null>
Prunes members from the guild based on how long they have been inactive.
Returns
The number of members that were/will be kicked
NameTypeOptionalDescription
optionsGuildPruneMembersOptions & { dry?: false; count: false }NoOptions for pruning
removeRole(options):Promise<GuildMember | User | Snowflake>
Removes a role from a member.
NameTypeOptionalDescription
optionsAddOrRemoveGuildMemberRoleOptionsNoOptions for removing the role
resolve(idOrInstance):Holds
Resolves a data entry to a data Object.
Returns
An instance from this Manager
NameTypeOptionalDescription
idOrInstanceHoldsNoThe id or instance of something in this Manager
resolveId(idOrInstance):K
Resolves a data entry to an instance id.
Returns
NameTypeOptionalDescription
idOrInstanceK | HoldsNoThe id or instance of something in this Manager
Searches for members in the guild based on a query.
NameTypeOptionalDescription
optionsGuildSearchMembersOptionsNoOptions for searching members
unban(user, reason?):Promise<User | null>
Unbans a user from the guild. Internally calls the remove method.
Returns
The user that was unbanned
NameTypeOptionalDescription
userUserResolvableNoThe user to unban
reasonstringYesReason for unbanning user
valueOf():Collection<K, Holds>