UserManager

User Manager to work with Users

Constructor

new UserManager(client, id) → {UserManager}

Parameters:
NameTypeDescription
clientobject

the Application Client

idstring

the id of the user

Returns:
Type: 
UserManager
Example
// You can use this way
const manager = new UserManager(<Client>);
const user = await manager.fetch(userid);
console.log(user);

// Or this way
const manager = new UserManager(<Client>, userid);
const user = await manager.fetch();
console.log(user);

Members

id :string|null

the id of the user

Type:
  • string | null

Methods

(async) fetch(userId) → {Promise.<object>}

Fetch the user from Discord

Parameters:
NameTypeDescription
userIdstring | null
Returns:
Type: 
Promise.<object>

(async) fetchMyApplication() → {Promise.<object>}

Fetch the current bot's application (Pretty useful for guild count!)

Returns:
Type: 
Promise.<object>

(async) fetchMyself() → {Promise.<object>}

Fetch the current bot from Discord

Returns:
Type: 
Promise.<object>

(async) sendDM(userId, data) → {Promise.<object>}

Send a message to the user

Parameters:
NameTypeDescription
userIdstring | null

the user id

dataobject

the message payload

Returns:
Type: 
Promise.<object>