ThreadMemberManager
ThreadMemberManager ⇐ Base
Manages the members of a thread in a guild.
Kind: global class
Extends: Base
- ThreadMemberManager ⇐
Base
- new ThreadMemberManager(guildId, threadId, client)
- .cache ⇒
- ._add(members, [guildId], [threadId], [options])
- .join() ⇒
Promise.<void>
- .fetch(user, [options]) ⇒
Promise
- ._fetchId(user, [cache], [force]) ⇒
Promise.<string>
- .add([user]) ⇒
Promise.<void>
- .remove([user]) ⇒
Promise.<(GuildMember|null)>
new ThreadMemberManager(guildId, threadId, client)
Constructs a new instance of the ThreadWatcher class.
Param | Type | Description |
---|---|---|
guildId | string | The ID of the guild the thread belongs to. |
threadId | string | The ID of the thread. |
client | Client | The client instance. |
threadMemberManager.cache ⇒
Getter method for the cache property.
Kind: instance property of ThreadMemberManager
Returns: The Collection object representing the cache.
threadMemberManager._add(members, [guildId], [threadId], [options])
Adds a member to a thread.
Kind: instance method of ThreadMemberManager
Param | Type | Default | Description |
---|---|---|---|
members | string | Object | The member or user ID to add to the thread. | |
[guildId] | string | ”this.guildId” | The ID of the guild where the thread is located. |
[threadId] | string | ”this.threadId” | The ID of the thread. |
[options] | object | { cache: true, force: false } | Additional options for adding the member. |
[options.cache] | boolean | true | Whether to cache the thread member. |
[options.force] | boolean | false | Whether to force fetching the thread member even if it is already cached. |
threadMemberManager.join() ⇒ Promise.<void>
Joins the current user to a thread in a channel.
Kind: instance method of ThreadMemberManager
Returns: Promise.<void>
- - A promise that resolves when the user has successfully joined the thread.
threadMemberManager.fetch(user, [options]) ⇒ Promise
Fetches data for a user or thread from the server.
Kind: instance method of ThreadMemberManager
Returns: Promise
- A promise that resolves with the fetched data.
Param | Type | Default | Description |
---|---|---|---|
user | string | object | The user ID or object containing user information. | |
[options] | object | Additional options for the fetch request. | |
[options.cache] | boolean | true | Whether to cache the fetched data. |
[options.force] | boolean | false | Whether to force a fresh fetch from the server. |
threadMemberManager._fetchId(user, [cache], [force]) ⇒ Promise.<string>
Fetches the ID of a user asynchronously.
Kind: instance method of ThreadMemberManager
Returns: Promise.<string>
- A promise that resolves to the user ID.
Param | Type | Default | Description |
---|---|---|---|
user | string | UserObject | The user or user ID to fetch the ID for. | |
[cache] | boolean | true | Whether to cache the fetched ID. |
[force] | boolean | true | Whether to force the fetch even if the ID is already cached. |
threadMemberManager.add([user]) ⇒ Promise.<void>
Adds a user to the thread.
Kind: instance method of ThreadMemberManager
Returns: Promise.<void>
- - A promise that resolves when the user has been added to the thread.
Param | Type | Default | Description |
---|---|---|---|
[user] | string | User | ”this.client.user.id” | The user to add to the thread. Can be a user ID or a User object. |
threadMemberManager.remove([user]) ⇒ Promise.<(GuildMember|null)>
Removes a user from the thread.
Kind: instance method of ThreadMemberManager
Returns: Promise.<(GuildMember|null)>
- - A promise that resolves with the deleted member object, or null if the user was not found.
Param | Type | Default | Description |
---|---|---|---|
[user] | string | UserResolvable | ”this.client.user.id” | The user to remove from the thread. Defaults to the client’s user ID. |