Skip to content

@vttforge/types / UserLike

Interface: UserLike ​

One connected or known user.

Extends ​

Properties ​

active ​

readonly active: boolean


character ​

readonly character: ActorLike<Record<string, unknown>, ItemLike<Record<string, unknown>>> | null


color ​

readonly color: unknown


documentName ​

readonly documentName: string

'Actor', 'Item', 'ActiveEffect', and so on.

Inherited from ​

DocumentMembers.documentName


flags ​

readonly flags: DocumentFlags

Inherited from ​

DocumentMembers.flags


id ​

readonly id: string | null

Inherited from ​

DocumentMembers.id


img ​

readonly img: string | null

Inherited from ​

DocumentMembers.img


isGM ​

readonly isGM: boolean


isOwner ​

readonly isOwner: boolean

Whether the current user owns this document.

Inherited from ​

DocumentMembers.isOwner


isSelf ​

readonly isSelf: boolean


name ​

readonly name: string

Inherited from ​

DocumentMembers.name


parent ​

readonly parent: DocumentMembers<Record<string, unknown>> | null

The document this one is embedded in, or null at the top level.

Inherited from ​

DocumentMembers.parent


system ​

readonly system: System

The type data model instance. Its fields are the schema's fields.

Inherited from ​

DocumentMembers.system


targets ​

readonly targets: Set<unknown>


type ​

readonly type: string

The subtype, as declared under documentTypes in the manifest.

Inherited from ​

DocumentMembers.type


uuid ​

readonly uuid: string

Inherited from ​

DocumentMembers.uuid


viewedScene ​

readonly viewedScene: string | null

Methods ​

delete() ​

delete(operation?): Promise<UserLike | undefined>

Parameters ​

operation? ​

Record<string, unknown>

Returns ​

Promise<UserLike | undefined>

Inherited from ​

DocumentMembers.delete


getFlag() ​

getFlag<T>(scope, key): T | undefined

Type Parameters ​

T ​

T = unknown

Parameters ​

scope ​

string

key ​

string

Returns ​

T | undefined

Inherited from ​

DocumentMembers.getFlag


hasPermission() ​

hasPermission(permission): boolean

Parameters ​

permission ​

string

Returns ​

boolean


hasRole() ​

hasRole(role, options?): boolean

Parameters ​

role ​

string | number

options? ​
exact? ​

boolean

Returns ​

boolean


query() ​

query<T>(name, data, options?): Promise<T>

Call a handler registered in CONFIG.queries on this user's client.

Type Parameters ​

T ​

T = unknown

Parameters ​

name ​

string

data ​

unknown

options? ​
timeout? ​

number

Returns ​

Promise<T>


setFlag() ​

setFlag(scope, key, value): Promise<UserLike>

Parameters ​

scope ​

string

key ​

string

value ​

unknown

Returns ​

Promise<UserLike>

Inherited from ​

DocumentMembers.setFlag


testUserPermission() ​

testUserPermission(user, permission, options?): boolean

Whether a user has at least this level of access to the document.

isOwner answers the same question for the current user and the highest level. This answers it for any user and any level, which is what a package asks before it shows someone another person's document.

ts
if (item.testUserPermission(game.user, 'LIMITED')) render(link);

Parameters ​

user ​

unknown

permission ​

number | "NONE" | "LIMITED" | "OBSERVER" | "OWNER"

options? ​
exact? ​

boolean

Returns ​

boolean

Inherited from ​

DocumentMembers.testUserPermission


toObject() ​

toObject(source?): Record<string, unknown>

A plain-object copy. source reads the stored data instead of the prepared data.

Parameters ​

source? ​

boolean

Returns ​

Record<string, unknown>

Inherited from ​

DocumentMembers.toObject


unsetFlag() ​

unsetFlag(scope, key): Promise<UserLike>

Parameters ​

scope ​

string

key ​

string

Returns ​

Promise<UserLike>

Inherited from ​

DocumentMembers.unsetFlag


update() ​

update(data, operation?): Promise<UserLike | undefined>

Parameters ​

data ​

Record<string, unknown>

operation? ​

Record<string, unknown>

Returns ​

Promise<UserLike | undefined>

Inherited from ​

DocumentMembers.update

MIT licensed.