GuildMemberManager
GuildMemberManager ⇐ Base
Represents a manager for guild members.
Kind: global class
Extends: Base
- GuildMemberManager ⇐
Base
- new GuildMemberManager(guildId, client)
- instance
- .cache ⇒
- ._add(members, [guildId], [options]) ⇒
GuildMember
|null
- .fetch(member, options)
- .list([options]) ⇒
Promise.<Cache>
- .search(options) ⇒
Promise.<Cache>
- .kick(member, reason) ⇒
Promise.<GuildMember>
- .ban(member, [options]) ⇒
Promise.<GuildMember>
- .unban(user, reason) ⇒
User
- .edit(member, [options]) ⇒
Promise.<GuildMember>
- ._fetchId(member, [options]) ⇒
Promise.<Object>
- static
- .transformTimeout(date) ⇒
string
|null
- .transformOptions(options, [edit]) ⇒
Object
- .transformPayload(payload) ⇒
string
|Array.<string>
|undefined
- .transformTimeout(date) ⇒
new GuildMemberManager(guildId, client)
Constructs a new instance of the class.
Param | Type | Description |
---|---|---|
guildId | string | The ID of the guild. |
client | Client | The client object. |
guildMemberManager.cache ⇒
Returns the cache object.
Kind: instance property of GuildMemberManager
Returns: The cache object.
guildMemberManager._add(members, [guildId], [options]) ⇒ GuildMember
| null
Adds a member to the guild.
Kind: instance method of GuildMemberManager
Returns: GuildMember
| null
- The added member object
Param | Type | Default | Description |
---|---|---|---|
members | string | GuildMember | The member to add. Can be either a string representing the member’s ID or a GuildMember object. | |
[guildId] | string | ”this.guildId” | The ID of the guild to add the member to. |
[options] | object | {cache: true, force: false} | Additional options for adding the member. |
[options.cache] | boolean | true | Whether to cache the member object. |
[options.force] | boolean | false | Whether to force adding the member even if it already exists in the cache. |
guildMemberManager.fetch(member, options)
Fetches guild members from the server.
Kind: instance method of GuildMemberManager
Param | Type | Default | Description |
---|---|---|---|
member | string | object | The member to fetch. Can be a member ID or a member object. | |
options | object | Additional options for the fetch. | |
[options.cache] | boolean | true | Whether to cache the fetched members. |
[options.force] | boolean | false | Whether to force fetch the members even if they are already cached. |
[options.query] | string | ”""“ | A query string to filter the members. |
[options.limit] | number | 1000 | The maximum number of members to fetch. |
[options.presences] | boolean | Whether to include |
guildMemberManager.list([options]) ⇒ Promise.<Cache>
Retrieves a list of members from the guild.
Kind: instance method of GuildMemberManager
Returns: Promise.<Cache>
- - A promise that resolves to a Cache object containing the retrieved members.
Param | Type | Default | Description |
---|---|---|---|
[options] | Object | The options for listing members. | |
[options.limit] | number | 50 | The maximum number of members to retrieve. |
guildMemberManager.search(options) ⇒ Promise.<Cache>
Searches for members in a guild based on the provided query.
Kind: instance method of GuildMemberManager
Returns: Promise.<Cache>
- A Promise that resolves to a Cache object containing the search results.
Throws:
RangeError
If the query is not provided.
Param | Type | Default | Description |
---|---|---|---|
options | Object | The search options. | |
options.query | string | The query to search for. | |
[options.limit] | number | 50 | The maximum number of results to return. |
guildMemberManager.kick(member, reason) ⇒ Promise.<GuildMember>
Kicks a member from the guild.
Kind: instance method of GuildMemberManager
Returns: Promise.<GuildMember>
- - The deleted member object.
Throws:
RangeError
- If a valid GuildMember is not specified.
Param | Type | Description |
---|---|---|
member | string | GuildMember | The member to kick. Can be either a string representing the member’s ID or a GuildMember object. |
reason | string | The reason for kicking the member. Optional. |
guildMemberManager.ban(member, [options]) ⇒ Promise.<GuildMember>
Bans a member from the guild.
Kind: instance method of GuildMemberManager
Returns: Promise.<GuildMember>
- - The banned member.
Param | Type | Description |
---|---|---|
member | GuildMember | The member to ban. |
[options] | Object | Additional options for the ban. |
guildMemberManager.unban(user, reason) ⇒ User
Unbans a user from the guild.
Kind: instance method of GuildMemberManager
Returns: User
- - The unbanned user.
Throws:
Error
- If the user or guild is not found.
Param | Type | Description |
---|---|---|
user | User | The user to unban. |
reason | string | The reason for unbanning the user. |
guildMemberManager.edit(member, [options]) ⇒ Promise.<GuildMember>
Edits a guild member with the specified options.
Kind: instance method of GuildMemberManager
Returns: Promise.<GuildMember>
- A promise that resolves with the edited GuildMember object.
Param | Type | Description |
---|---|---|
member | string | GuildMember | The member to edit. Can be either a member ID or a GuildMember object. |
[options] | Object | The options for editing the member. |
[options.reason] | string | The reason for the edit. |
guildMemberManager._fetchId(member, [options]) ⇒ Promise.<Object>
Fetches the ID of a member from the guild.
Kind: instance method of GuildMemberManager
Returns: Promise.<Object>
- - A promise that resolves to the fetched member object.
Param | Type | Default | Description |
---|---|---|---|
member | string | Object | The member object or the ID of the member. | |
[options] | Object | Additional options for the fetch. | |
[options.force] | boolean | Whether to force the fetch even if the member is already cached. | |
[options.cache] | boolean | true | Whether to cache the fetched member. |
GuildMemberManager.transformTimeout(date) ⇒ string
| null
Transforms a given date into an ISO string format.
Kind: static method of GuildMemberManager
Returns: string
| null
- - The transformed date in ISO string format, or null if the input is null.
Param | Type | Description |
---|---|---|
date | Date | string | null | The date to transform. |
GuildMemberManager.transformOptions(options, [edit]) ⇒ Object
Transforms the given options object based on the provided parameters.
Kind: static method of GuildMemberManager
Returns: Object
- - The transformed options object.
Param | Type | Default | Description |
---|---|---|---|
options | Object | The options object to transform. | |
[edit] | boolean | false | Indicates whether the transformation is for editing purposes. |
GuildMemberManager.transformPayload(payload) ⇒ string
| Array.<string>
| undefined
Transforms the given payload into a new format.
Kind: static method of GuildMemberManager
Returns: string
| Array.<string>
| undefined
- - The transformed payload.
Param | Type | Description |
---|---|---|
payload | any | The payload to transform. |