diff --git a/src/client/ClientDataManager.js b/src/client/ClientDataManager.js index ad7c0285c..62924904e 100644 --- a/src/client/ClientDataManager.js +++ b/src/client/ClientDataManager.js @@ -84,7 +84,7 @@ class ClientDataManager { } killUser(user) { - this.users.delete(user.id); + this.client.users.delete(user.id); } killChannel(channel) { diff --git a/src/structures/GuildChannel.js b/src/structures/GuildChannel.js index d5304aa26..e39d1bb89 100644 --- a/src/structures/GuildChannel.js +++ b/src/structures/GuildChannel.js @@ -137,7 +137,7 @@ class GuildChannel extends Channel { const roleOverwrites = []; const memberOverwrites = []; - for (const overwrite of this.permissionOverwrites) { + for (const overwrite of this.permissionOverwrites.values()) { if (overwrite.id === member.id) { memberOverwrites.push(overwrite); } else if (memberRoles.indexOf(overwrite.id) > -1) { diff --git a/src/structures/interface/TextBasedChannel.js b/src/structures/interface/TextBasedChannel.js index 7554722aa..cd30fbfe4 100644 --- a/src/structures/interface/TextBasedChannel.js +++ b/src/structures/interface/TextBasedChannel.js @@ -166,7 +166,7 @@ class TextBasedChannel { } if (this.messages.size >= maxSize) { - this.messages.delete(Array.from(this.messages.keys())[0]); + this.messages.delete(this.messages.keys().next().value); } this.messages.set(message.id, message); diff --git a/src/util/Collection.js b/src/util/Collection.js index f33053a33..67168cb24 100644 --- a/src/util/Collection.js +++ b/src/util/Collection.js @@ -77,6 +77,8 @@ class Collection extends Map { * collection.getAll('username', 'Bob'); */ findAll(key, value) { + if (typeof key !== 'string') throw new TypeError('key must be a string'); + if (typeof value === 'undefined') throw new Error('value must be specified'); const results = []; for (const item of this.values()) { if (item[key] === value) { @@ -95,6 +97,8 @@ class Collection extends Map { * collection.get('id', '123123...'); */ find(key, value) { + if (typeof key !== 'string') throw new TypeError('key must be a string'); + if (typeof value === 'undefined') throw new Error('value must be specified'); for (const item of this.values()) { if (item[key] === value) { return item;