mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-15 11:03:30 +01:00
added updating of messages
This commit is contained in:
30
lib/list.js
30
lib/list.js
@@ -34,6 +34,22 @@ exports.List.prototype.length = function() {
|
||||
return this.contents.length;
|
||||
}
|
||||
|
||||
exports.List.prototype.getIndex = function( object ){
|
||||
|
||||
var index = false;
|
||||
|
||||
for(elementIndex in this.contents){
|
||||
var element = this.contents[elementIndex];
|
||||
if( element[this.discriminator] == object[this.discriminator] ){
|
||||
return elementIndex;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return index;
|
||||
|
||||
}
|
||||
|
||||
exports.List.prototype.removeIndex = function( index ) {
|
||||
this.contents.splice( index, 1 );
|
||||
}
|
||||
@@ -50,6 +66,20 @@ exports.List.prototype.removeElement = function( child ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
exports.List.prototype.updateElement = function( child, newChild ){
|
||||
|
||||
for ( _element in this.contents ) {
|
||||
var element = this.contents[_element];
|
||||
if ( child[ this.discriminator ] == element[ this.discriminator ] ) {
|
||||
this.contents[_element] = newChild;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
exports.List.prototype.concatSublists = function( whereList, discriminator ) {
|
||||
//this is meant to look at the contents, and assuming the contents are all lists, concatenate their values.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user