mirror of
https://github.com/danbulant/discord.js
synced 2026-05-25 21:12:06 +00:00
Added Client.uptime (#533)
* Added Client.uptime * Added Client.uptime * Update Client.js
This commit is contained in:
parent
d029227a8e
commit
7892e62604
2 changed files with 14 additions and 0 deletions
|
|
@ -94,6 +94,11 @@ class Client extends EventEmitter {
|
|||
* @type {?String}
|
||||
*/
|
||||
this.password = null;
|
||||
/**
|
||||
* The time in milliseconds the Client connected
|
||||
* @type {?Number}
|
||||
*/
|
||||
this.readyTime = null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -124,6 +129,14 @@ class Client extends EventEmitter {
|
|||
return this.rest.methods.loginToken(email);
|
||||
}
|
||||
|
||||
/**
|
||||
* The uptime for the logged in Client
|
||||
* @type {?Number}
|
||||
*/
|
||||
get uptime() {
|
||||
return this.readyTime ? Date.now() - this.readyTime : null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
module.exports = Client;
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ class ReadyHandler extends AbstractHandler {
|
|||
|
||||
const clientUser = new ClientUser(client, data.user);
|
||||
client.user = clientUser;
|
||||
client.readyTime = Date.now();
|
||||
client.users.set(clientUser.id, clientUser);
|
||||
for (const guild of data.guilds) {
|
||||
client.dataManager.newGuild(guild);
|
||||
|
|
|
|||
Loading…
Reference in a new issue