Class

UserClient

UserClient(settings)

Holds data about currently logged in user

Constructor

# new UserClient(settings)

Creates new userclient

Parameters:
Name Type Description
settings object

View Source classes/userClient.ts, line 20

Classes

UserClient

Methods

# static login(user, auth) → {Promise.<UserClient>}

Tries to login with given details

Parameters:
Name Type Description
user User
auth Token | string

Token or string

View Source classes/userClient.ts, line 634

Promise.<UserClient>

# async static loginWithPassword(user, password) → {Promise.<UserClient>}

Tries to login with password

Parameters:
Name Type Description
user User
password string

View Source classes/userClient.ts, line 652

Promise.<UserClient>

# async static loginWithToken(ctx, token) → {Promise.<UserClient>}

Tries to login with token

Parameters:
Name Type Description
ctx RequestContext
token token

View Source classes/userClient.ts, line 643

Promise.<UserClient>

# async static register(user) → {Promise.<UserClient>}

Registers user

Parameters:
Name Type Description
user User

View Source classes/userClient.ts, line 660

Promise.<UserClient>

# delete() → {Promise.<void>}

Deletes user data (deletes from DB)

View Source classes/userClient.ts, line 768

Promise.<void>

# async findReport(user, type, resource) → {Promise.<(ModQueueItem|void)>}

Tries to find given report

Parameters:
Name Type Description
user SnowflakeString
type ModQueueItemType
resource SnowflakeString

View Source classes/userClient.ts, line 746

Promise.<(ModQueueItem|void)>

# async getBlockedUsers() → {Promise.<Array.<UserRelation>>}

Gets blocked users

View Source classes/userClient.ts, line 709

Promise.<Array.<UserRelation>>

# async getMessageCount(uid) → {Promise.<number>}

Returns message count

Parameters:
Name Type Description
uid bigint | User | SnowflakeString | Snowflake

View Source classes/userClient.ts, line 684

Promise.<number>

# async getMessages(uid, max, page) → {Promise.<Collection.<SnowflakeString, Message>>}

Gets conversation with user

Parameters:
Name Type Description
uid number | User | SnowflakeString | Snowflake
max number

Max items per page

page number

Current page

View Source classes/userClient.ts, line 694

Promise.<Collection.<SnowflakeString, Message>>

# async getModQueue(page, size) → {Promise.<Array.<ModQueueItem>>}

Fetches items in mod queue

Parameters:
Name Type Description
page number
size number

View Source classes/userClient.ts, line 718

Promise.<Array.<ModQueueItem>>

# async getModQueueLength(itemopt) → {Promise.<number>}

Returns the length of mod queue

Parameters:
Name Type Attributes Description
item any <optional>

to get reports of

View Source classes/userClient.ts, line 736

Promise.<number>

# async getReceivedMessageCount() → {Promise.<number>}

Returns received message count

View Source classes/userClient.ts, line 676

Promise.<number>

# async getReceivedMessages(max, page) → {Promise.<Collection.<SnowflakeString, Message>>}

Gets received messages

Parameters:
Name Type Description
max number

Max items per page

page number

Current page

View Source classes/userClient.ts, line 669

Promise.<Collection.<SnowflakeString, Message>>

# async getReportsOf(item, page, size) → {Promise.<Collection.<SnowflakeString, ModQueueItem>>}

Gets the reports of selected item

Parameters:
Name Type Description
item any

to get reports of

page number
size number

View Source classes/userClient.ts, line 728

Promise.<Collection.<SnowflakeString, ModQueueItem>>

# async report(item, reason) → {Promise.<ModQueueItem>}

Reports an item

Parameters:
Name Type Description
item any

to report

reason string

of report

View Source classes/userClient.ts, line 755

Promise.<ModQueueItem>

# async sendMessage(message) → {Promise.<Message>}

Sends new message

Parameters:
Name Type Description
message Message

Message to send

View Source classes/userClient.ts, line 702

Promise.<Message>

# toJSON() → {Object}

Creates a JSON-compatible object

View Source classes/userClient.ts, line 774

Object

# async update() → {Promise.<void>}

Updates user data (synchronizes DB with class)

View Source classes/userClient.ts, line 762

Promise.<void>

# async updateLastLogin() → {Promise.<void>}

Updates last login time

View Source classes/userClient.ts, line 610

Promise.<void>