Skip to content

UserManager

classe · Source

Manages API methods for users and stores their cache.

Extends: CachedManager

Properties

cache

cache: Collection<Snowflake, User>

The cache of this manager Source

_cache

readonly · private

_cache: Collection

The private cache of items for this manager. Source

holds

readonly · private

holds: function

The data structure belonging to this manager. Source

client

readonly

client: Client

The client that instantiated this Manager Source

Methods

dmChannel

private

dmChannel(userId: Snowflake): DMChannel

The DM between the client's user and a user Parameters

NameTypeDescription
userIdSnowflakeThe user id

Returns: DMChannelSource

createDM

async

async createDM(user: UserResolvable, options?: BaseFetchOptions): Promise<DMChannel>

Creates a DMChannel between the client and a user. Parameters

NameTypeDescription
userUserResolvableThe UserResolvable to identify
options?BaseFetchOptionsAdditional options for this fetch

Returns: Promise<DMChannel>Source

deleteDM

async

async deleteDM(user: UserResolvable): Promise<DMChannel>

Deletes a DMChannel (if one exists) between the client and a user. Resolves with the channel if successful. Parameters

NameTypeDescription
userUserResolvableThe UserResolvable to identify

Returns: Promise<DMChannel>Source

fetch

async

async fetch(user: UserResolvable, options?: BaseFetchOptions): Promise<User>

Obtains a user from Discord, or the user cache if it's already available. Parameters

NameTypeDescription
userUserResolvableThe user to fetch
options?BaseFetchOptionsAdditional options for this fetch

Returns: Promise<User>Source

send

async

async send(user: UserResolvable, options: string | MessagePayload | MessageOptions): Promise<Message>

Sends a message to a user. Parameters

NameTypeDescription
userUserResolvableThe UserResolvable to identify
optionsstring | MessagePayload | MessageOptionsThe options to provide

Returns: Promise<Message>Source

resolve

resolve(user: UserResolvable): User

Resolves a UserResolvable to a User object. Parameters

NameTypeDescription
userUserResolvableThe UserResolvable to identify

Returns: UserSource

resolveId

resolveId(user: UserResolvable): Snowflake

Resolves a UserResolvable to a User id. Parameters

NameTypeDescription
userUserResolvableThe UserResolvable to identify

Returns: SnowflakeSource

Unofficial software. Not affiliated with or supported by Discord.