mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-11 00:53:31 +01:00
Add debug stuff
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -25,8 +25,10 @@ class ClientManager {
|
||||
* @param {function} reject Function to run when connection fails
|
||||
*/
|
||||
connectToWebSocket(token, resolve, reject) {
|
||||
this.client.emit('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.ws.connect(gateway);
|
||||
this.client.once(Constants.Events.READY, () => resolve(token));
|
||||
}).catch(reject);
|
||||
|
||||
@@ -14,6 +14,7 @@ class RESTMethods {
|
||||
|
||||
loginEmailPassword(email, password) {
|
||||
return new Promise((resolve, reject) => {
|
||||
this.rest.client.emit('debug', 'client launched using email and password - should use token instead');
|
||||
this.rest.client.email = email;
|
||||
this.rest.client.password = password;
|
||||
this.rest.makeRequest('post', Constants.Endpoints.login, false, { email, password })
|
||||
|
||||
@@ -56,6 +56,7 @@ class WebSocketManager {
|
||||
* @param {string} gateway The gateway to connect to
|
||||
*/
|
||||
connect(gateway) {
|
||||
this.client.emit('debug', `connecting to gateway ${gateway}`);
|
||||
this.normalReady = false;
|
||||
this.status = Constants.Status.CONNECTING;
|
||||
this.ws = new WebSocket(gateway);
|
||||
@@ -108,6 +109,7 @@ class WebSocketManager {
|
||||
* Run whenever the gateway connections opens up
|
||||
*/
|
||||
eventOpen() {
|
||||
this.client.emit('debug', 'connection to gateway opened');
|
||||
if (this.reconnecting) this._sendResume();
|
||||
else this._sendNewIdentify();
|
||||
}
|
||||
|
||||
@@ -14,6 +14,8 @@ client.on('ready', () => {
|
||||
console.log('ready!');
|
||||
});
|
||||
|
||||
client.on('debug', console.log);
|
||||
|
||||
client.on('message', message => {
|
||||
if (true) {
|
||||
if (message.content === 'makechann') {
|
||||
|
||||
Reference in New Issue
Block a user