# new User(param0)
User class constructor
Parameters:
| Name | Type | Description |
|---|---|---|
param0 |
Object
|
user data |
Classes
Methods
# static fromDatabase(data, ctx) → {User}
Loads the user from database data
Parameters:
| Name | Type | Description |
|---|---|---|
data |
DBUser
|
|
ctx |
RequestContext
|
# async static getUser(id, ctx, client) → {Promise.<User>}
Loads user from DB
Parameters:
| Name | Type | Description |
|---|---|---|
id |
number
|
Snowflake
|
string
|
User snowflake to load |
ctx |
RequestContext
|
|
client |
UserClient
|
user
Promise.<User>
# static isUser(user) → {boolean}
Checks if user resolvable is user or not. Used for TS.
Parameters:
| Name | Type | Description |
|---|---|---|
user |
UserResolvable
|
boolean
# static resolveUserID(user) → {SnowflakeString}
Resolves params to string
Parameters:
| Name | Type | Description |
|---|---|---|
user |
UserResolvable
|
SnowflakeString
# static searchUsers(filters) → {Promise.<Collection.<string, User>>}
Searches users
Parameters:
| Name | Type | Description |
|---|---|---|
filters |
UserFilters
|
Promise.<Collection.<string, User>>
# static searchUsersCount(filters) → {number}
Returns number of results for a specific search
Parameters:
| Name | Type | Description |
|---|---|---|
filters |
UserFilters
|
number
# static userFromDB(ids, user, ctx) → {User}
Loads user from DB (OLD)
Parameters:
| Name | Type | Description |
|---|---|---|
ids |
SnowflakeResolvable
|
|
user |
any
|
|
ctx |
RequestContext
|
- Deprecated:
- Yes
# comparePosition(userOrType) → {boolean}
Compares position of user and user/type
Parameters:
| Name | Type | Description |
|---|---|---|
userOrType |
User
|
UserType
|
to compare |
boolean
# async getAnimations(max, page) → {Promise.<Collection.<SnowflakeString, BasicAnimation>>}
Gets animations created by user
Parameters:
| Name | Type | Description |
|---|---|---|
max |
number
|
Max animations per page |
page |
number
|
Current page to show |
Promise.<Collection.<SnowflakeString, BasicAnimation>>
# async getAnimationsCount() → {Promise.<number>}
Gets number of animations created by user
Promise.<number>
# async getComments(limit, page) → {Promise.<Collection.<SnowflakeString, Comment>>}
Gets comments created by user
Parameters:
| Name | Type | Description |
|---|---|---|
limit |
number
|
Max items per page |
page |
number
|
Current page |
Promise.<Collection.<SnowflakeString, Comment>>
# async getFiles(limit, page, publicOnlyopt) → {Promise.<Collection.<SnowflakeString, File>>}
Gets files uploaded by user
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
limit |
number
|
Max items per page |
||
page |
number
|
Current page |
||
publicOnly |
boolean
|
<optional> |
true | If true, only public files are returned |
Promise.<Collection.<SnowflakeString, File>>
# getFilesCount(publicOnlyopt) → {Promise.<number>}
Gets number of files uploaded by user
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
publicOnly |
boolean
|
<optional> |
true | If true, only public files are counted |
Promise.<number>
# async getFollowers() → {Promise.<Array.<UserRelation>>}
Gets followers
Promise.<Array.<UserRelation>>
# async getFollows() → {Promise.<Array.<UserRelation>>}
Gets followed users
Promise.<Array.<UserRelation>>
# async getRatings(max, page) → {Promise.<Collection.<SnowflakeString, Rating>>}
Gets ratings created by user
Parameters:
| Name | Type | Description |
|---|---|---|
max |
number
|
Max items per page |
page |
number
|
Current page |
Promise.<Collection.<SnowflakeString, Rating>>
# async getRatingsCount() → {Promise.<number>}
Gets number of ratings created by user
Promise.<number>
# async getRelation(uid) → {Promise.<UserRelation>}
Gets relation between client and specified user
Parameters:
| Name | Type | Description |
|---|---|---|
uid |
UserResolvable
|
Promise.<UserRelation>
# hasPremium() → {boolean}
Gets if the user has active premium or not. Should not be used for 'is user getting billed' - can be mod for that.
boolean
# async setType(ctx, type) → {Promise.<void>}
Sets new type of user
Parameters:
| Name | Type | Description |
|---|---|---|
ctx |
RequestContext
|
|
type |
UserType
|
New type to set |
Promise.<void>