diff --git a/src/client/Client.js b/src/client/Client.js index c0b56f66d..e8a422e68 100644 --- a/src/client/Client.js +++ b/src/client/Client.js @@ -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; } /** diff --git a/src/client/websocket/WebSocketConnection.js b/src/client/websocket/WebSocketConnection.js index 1b458e5a1..2937f62c1 100644 --- a/src/client/websocket/WebSocketConnection.js +++ b/src/client/websocket/WebSocketConnection.js @@ -59,7 +59,7 @@ class WebSocketConnection extends EventEmitter { /** * The current status of the client - * @type {number} + * @type {Status} */ this.status = Constants.Status.IDLE; diff --git a/src/util/Constants.js b/src/util/Constants.js index 601c26a95..7a8e13443 100644 --- a/src/util/Constants.js +++ b/src/util/Constants.js @@ -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 = {