Class: UserManager
Extends: CachedManager
Manages API methods for users and stores their cache
Constructors
Constructor
new UserManager(
client,iterable?):UserManager
Parameters
| Name | Type | Description |
|---|---|---|
client | Client | The client that instantiated this manager |
iterable? | Iterable<User, any, any> | An iterable of users to cache |
Returns
UserManager
Overrides
Properties
holds()
readonlyholds: (...args) =>User
Parameters
| Name | Type | Description |
|---|---|---|
args | any[] |
Returns
Inherited from
Accessors
cache
Get Signature
get cache():
Map<K,V>
The cache of items for this manager
Returns
Map<K, V>
Inherited from
Methods
_add()
protected_add(data,cache?,options?):User
Adds an item to the cache
Parameters
| Name | Type | Description |
|---|---|---|
data | any | The data to add |
cache? | boolean | Whether to cache the item |
options? | object | Additional options |
Returns
The cached item
Inherited from
fetch(user, options?): Promise<null | User>
`
Obtains a user from Yurba, or the user cache if it's already available
Parameters
| Name | Type | Description |
|---|---|---|
user | string | number | The user ID or link to fetch |
options? | object | Additional options |
Returns
Promise<null | User>
The user, or null if not found
Example
ts
// Fetch a user by ID
const user = await client.users.fetch(123456);
// Fetch a user by link
const user = await client.users.fetch('username');
// Force fetch from API
const user = await client.users.fetch(123456, { force: true });resolve(user): null | User
`
Resolves a user resolvable to a User object
Parameters
| Name | Type | Description |
|---|---|---|
user | User | The user resolvable to resolve |
Returns
null | User
The resolved user
Overrides
resolveId(user): null | number
`
Resolves a user resolvable to a user ID
Parameters
| Name | Type | Description |
|---|---|---|
user | string | number | User | The user resolvable to resolve |
Returns
null | number
The resolved user ID
Overrides
valueOf()
valueOf():
Map<number,User>
Returns the primitive value of the specified object.
Returns
Map<number, User>