fix/docs(Client): type status and do not throw an error if accessed before login

This commit is contained in:
SpaceEEC
2019-05-05 13:44:34 +02:00
parent 60013b7a10
commit 67da457c0a
3 changed files with 9 additions and 9 deletions

View File

@@ -186,11 +186,11 @@ class Client extends EventEmitter {
/**
* Current status of the client's connection to Discord
* @type {?number}
* @type {Status}
* @readonly
*/
get status() {
return this.ws.connection.status;
return this.ws.connection ? this.ws.connection.status : Constants.Status.IDLE;
}
/**

View File

@@ -59,7 +59,7 @@ class WebSocketConnection extends EventEmitter {
/**
* The current status of the client
* @type {number}
* @type {Status}
*/
this.status = Constants.Status.IDLE;

View File

@@ -242,12 +242,12 @@ const Endpoints = exports.Endpoints = {
/**
* The current status of the client. Here are the available statuses:
* * READY
* * CONNECTING
* * RECONNECTING
* * IDLE
* * NEARLY
* * DISCONNECTED
* * READY: 0
* * CONNECTING: 1
* * RECONNECTING: 2
* * IDLE: 3
* * NEARLY: 4
* * DISCONNECTED: 5
* @typedef {number} Status
*/
exports.Status = {