mirror of
https://github.com/danbulant/discord.js
synced 2026-05-26 05:22:15 +00:00
removed annoying time update messages
This commit is contained in:
parent
277e4929c4
commit
46e3a58c05
1 changed files with 5 additions and 16 deletions
21
index.js
21
index.js
|
|
@ -136,8 +136,6 @@ exports.Client.prototype.login = function( email, password ) {
|
|||
|
||||
var self = this;
|
||||
|
||||
var time = Date.now();
|
||||
|
||||
self.connectWebsocket();
|
||||
|
||||
Internal.XHR.login( email, password, function( err, token ) {
|
||||
|
|
@ -147,11 +145,11 @@ exports.Client.prototype.login = function( email, password ) {
|
|||
reason: "failed to log in",
|
||||
error: err
|
||||
} ] );
|
||||
self.websocket.close();
|
||||
} else {
|
||||
self.token = token;
|
||||
self.loggedIn = true;
|
||||
console.log("Took "+ (Date.now() - time) +" ms to login!");
|
||||
self.websocket.sendData();
|
||||
self.loggedIn = true;
|
||||
}
|
||||
|
||||
} );
|
||||
|
|
@ -173,8 +171,6 @@ exports.Client.prototype.connectWebsocket = function( cb ) {
|
|||
|
||||
var self = this;
|
||||
|
||||
var time = Date.now();
|
||||
|
||||
var sentInitData = false;
|
||||
|
||||
this.websocket = new WebSocket( Endpoints.WEBSOCKET_HUB );
|
||||
|
|
@ -198,9 +194,6 @@ exports.Client.prototype.connectWebsocket = function( cb ) {
|
|||
|
||||
var data = dat.d;
|
||||
|
||||
console.log("Took "+ (Date.now() - time) +" ms to get READY!");
|
||||
time = Date.now();
|
||||
|
||||
setInterval( function() {
|
||||
webself.keepAlive.apply( webself );
|
||||
}, data.heartbeat_interval );
|
||||
|
|
@ -222,10 +215,9 @@ exports.Client.prototype.connectWebsocket = function( cb ) {
|
|||
|
||||
self.cacheServer( _server, function( server ) {
|
||||
cached++;
|
||||
if ( cached >= toCache ) {
|
||||
if ( cached === toCache ) {
|
||||
self.ready = true;
|
||||
self.triggerEvent( "ready" );
|
||||
console.log("Took "+ (Date.now() - time) +" ms to prepare!");
|
||||
}
|
||||
} );
|
||||
}
|
||||
|
|
@ -350,12 +342,10 @@ exports.Client.prototype.connectWebsocket = function( cb ) {
|
|||
}
|
||||
this.websocket.onopen = function() {
|
||||
|
||||
this.sendData();
|
||||
this.sendData("onopen");
|
||||
|
||||
console.log("Took "+ (Date.now() - time) +" ms to open WS connection!");
|
||||
time = Date.now();
|
||||
}
|
||||
this.websocket.sendData = function(){
|
||||
this.websocket.sendData = function(why){
|
||||
if(this.readyState == 1 && !sentInitData && self.token){
|
||||
sentInitData = true;
|
||||
var connDat = {
|
||||
|
|
@ -368,7 +358,6 @@ exports.Client.prototype.connectWebsocket = function( cb ) {
|
|||
|
||||
connDat.d.properties = Internal.WebSocket.properties;
|
||||
this.sendPacket( connDat );
|
||||
time = Date.now();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue