mirror of
https://github.com/danbulant/discord.js
synced 2026-06-10 02:02:40 +00:00
Fixed some caching issues and list issue
When leaving a server, it is now removed from the known list. Also, the list "removeElement" function is improved to actually work!
This commit is contained in:
parent
f306d7bd5e
commit
5fc8a096c1
2 changed files with 13 additions and 12 deletions
1
index.js
1
index.js
|
|
@ -249,6 +249,7 @@ exports.Client.prototype.leaveServer = function( server, cb ){
|
||||||
if ( !res.ok ) {
|
if ( !res.ok ) {
|
||||||
cb( err );
|
cb( err );
|
||||||
} else {
|
} else {
|
||||||
|
client.serverList.removeElement( server );
|
||||||
cb( null );
|
cb( null );
|
||||||
}
|
}
|
||||||
} );
|
} );
|
||||||
|
|
|
||||||
12
lib/list.js
12
lib/list.js
|
|
@ -28,14 +28,14 @@ exports.List.prototype.removeIndex = function( index ) {
|
||||||
|
|
||||||
exports.List.prototype.removeElement = function( child ) {
|
exports.List.prototype.removeElement = function( child ) {
|
||||||
|
|
||||||
var index = this.contents.indexOf( child );
|
for ( _element in this.contents ) {
|
||||||
|
var element = this.contents[_element];
|
||||||
if ( index === -1 ) {
|
if ( child[ this.discriminator ] == element[ this.discriminator ] ) {
|
||||||
return false;
|
this.removeIndex( _element, 1 );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.removeIndex( index );
|
return false;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.List.prototype.concatSublists = function( whereList, discriminator ) {
|
exports.List.prototype.concatSublists = function( whereList, discriminator ) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue