mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-09 16:13:31 +01:00
ESLint stuff...
This commit is contained in:
@@ -1,34 +1,32 @@
|
||||
'use strict';
|
||||
|
||||
const Constants = require('../util/Constants');
|
||||
|
||||
class ClientManager {
|
||||
|
||||
constructor(client) {
|
||||
this.client = client;
|
||||
this.heartbeatInterval = null;
|
||||
}
|
||||
constructor(client) {
|
||||
this.client = client;
|
||||
this.heartbeatInterval = null;
|
||||
}
|
||||
|
||||
connectToWebSocket(token, resolve, reject) {
|
||||
this.client.store.token = token;
|
||||
this.client.rest.methods.GetGateway()
|
||||
.then(gateway => {
|
||||
this.client.ws.connect(gateway);
|
||||
this.client.once(Constants.Events.READY, () => resolve(token));
|
||||
})
|
||||
.catch(reject);
|
||||
connectToWebSocket(token, resolve, reject) {
|
||||
this.client.store.token = token;
|
||||
this.client.rest.methods.getGateway()
|
||||
.then(gateway => {
|
||||
this.client.ws.connect(gateway);
|
||||
this.client.once(Constants.Events.READY, () => resolve(token));
|
||||
})
|
||||
.catch(reject);
|
||||
|
||||
setTimeout(() => reject(Constants.Errors.TOOK_TOO_LONG), 1000 * 15);
|
||||
}
|
||||
setTimeout(() => reject(Constants.Errors.TOOK_TOO_LONG), 1000 * 15);
|
||||
}
|
||||
|
||||
setupKeepAlive(time) {
|
||||
this.heartbeatInterval = setInterval(() => {
|
||||
this.client.ws.send({
|
||||
op: Constants.OPCodes.HEARTBEAT,
|
||||
d: Date.now(),
|
||||
});
|
||||
}, time);
|
||||
}
|
||||
setupKeepAlive(time) {
|
||||
this.heartbeatInterval = setInterval(() => {
|
||||
this.client.ws.send({
|
||||
op: Constants.OPCodes.HEARTBEAT,
|
||||
d: Date.now(),
|
||||
});
|
||||
}, time);
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = ClientManager;
|
||||
|
||||
Reference in New Issue
Block a user