mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-10 08:33:30 +01:00
add disconnect event, document warn and debug events (#702)
* add documentation for events, and add a disconnect event, because i know people use that * generate docs, and fix a hastily copied docstring * fix permissions freak out
This commit is contained in:
committed by
Schuyler Cebulskie
parent
25531170ec
commit
7cb2e8eef7
@@ -25,10 +25,14 @@ class ClientManager {
|
||||
* @param {function} reject Function to run when connection fails
|
||||
*/
|
||||
connectToWebSocket(token, resolve, reject) {
|
||||
this.client.emit('debug', `Authenticated using token ${token}`);
|
||||
/**
|
||||
* Emitted when there is debug information
|
||||
* @event Client#debug
|
||||
*/
|
||||
this.client.emit(Constants.Events.DEBUG, `Authenticated using token ${token}`);
|
||||
this.client.token = token;
|
||||
this.client.rest.methods.getGateway().then(gateway => {
|
||||
this.client.emit('debug', `Using gateway ${gateway}`);
|
||||
this.client.emit(Constants.Events.DEBUG, `Using gateway ${gateway}`);
|
||||
this.client.ws.connect(gateway);
|
||||
this.client.once(Constants.Events.READY, () => resolve(token));
|
||||
}).catch(reject);
|
||||
|
||||
Reference in New Issue
Block a user