mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-16 19:43:29 +01:00
fix/docs(Client): type status and do not throw an error if accessed before login
This commit is contained in:
@@ -186,11 +186,11 @@ class Client extends EventEmitter {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Current status of the client's connection to Discord
|
* Current status of the client's connection to Discord
|
||||||
* @type {?number}
|
* @type {Status}
|
||||||
* @readonly
|
* @readonly
|
||||||
*/
|
*/
|
||||||
get status() {
|
get status() {
|
||||||
return this.ws.connection.status;
|
return this.ws.connection ? this.ws.connection.status : Constants.Status.IDLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ class WebSocketConnection extends EventEmitter {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* The current status of the client
|
* The current status of the client
|
||||||
* @type {number}
|
* @type {Status}
|
||||||
*/
|
*/
|
||||||
this.status = Constants.Status.IDLE;
|
this.status = Constants.Status.IDLE;
|
||||||
|
|
||||||
|
|||||||
@@ -242,12 +242,12 @@ const Endpoints = exports.Endpoints = {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* The current status of the client. Here are the available statuses:
|
* The current status of the client. Here are the available statuses:
|
||||||
* * READY
|
* * READY: 0
|
||||||
* * CONNECTING
|
* * CONNECTING: 1
|
||||||
* * RECONNECTING
|
* * RECONNECTING: 2
|
||||||
* * IDLE
|
* * IDLE: 3
|
||||||
* * NEARLY
|
* * NEARLY: 4
|
||||||
* * DISCONNECTED
|
* * DISCONNECTED: 5
|
||||||
* @typedef {number} Status
|
* @typedef {number} Status
|
||||||
*/
|
*/
|
||||||
exports.Status = {
|
exports.Status = {
|
||||||
|
|||||||
Reference in New Issue
Block a user