From bf221f2bef2871f019aa4a6978deb8460fff85b9 Mon Sep 17 00:00:00 2001 From: 1Computer1 <22125769+1Computer1@users.noreply.github.com> Date: Sat, 31 Jul 2021 04:45:33 -0400 Subject: [PATCH] fix: array/keyArray removed (#6245) --- src/structures/GuildChannel.js | 2 +- src/structures/Role.js | 2 +- src/structures/interfaces/TextBasedChannel.js | 2 +- src/util/Util.js | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/structures/GuildChannel.js b/src/structures/GuildChannel.js index acbc267c915f..4cf4f00dcc6f 100644 --- a/src/structures/GuildChannel.js +++ b/src/structures/GuildChannel.js @@ -153,7 +153,7 @@ class GuildChannel extends Channel { */ get position() { const sorted = this.guild._sortedChannels(this); - return sorted.array().indexOf(sorted.get(this.id)); + return [...sorted.values()].indexOf(sorted.get(this.id)); } /** diff --git a/src/structures/Role.js b/src/structures/Role.js index e9766749a96a..daa7fd0e6132 100644 --- a/src/structures/Role.js +++ b/src/structures/Role.js @@ -159,7 +159,7 @@ class Role extends Base { */ get position() { const sorted = this.guild._sortedRoles(); - return sorted.array().indexOf(sorted.get(this.id)); + return [...sorted.values()].indexOf(sorted.get(this.id)); } /** diff --git a/src/structures/interfaces/TextBasedChannel.js b/src/structures/interfaces/TextBasedChannel.js index 550240088395..53a2993317dc 100644 --- a/src/structures/interfaces/TextBasedChannel.js +++ b/src/structures/interfaces/TextBasedChannel.js @@ -293,7 +293,7 @@ class TextBasedChannel { */ async bulkDelete(messages, filterOld = false) { if (Array.isArray(messages) || messages instanceof Collection) { - let messageIds = messages instanceof Collection ? messages.keyArray() : messages.map(m => m.id ?? m); + let messageIds = messages instanceof Collection ? [...messages.keys()] : messages.map(m => m.id ?? m); if (filterOld) { messageIds = messageIds.filter(id => Date.now() - SnowflakeUtil.deconstruct(id).timestamp < 1209600000); } diff --git a/src/util/Util.js b/src/util/Util.js index 12858d0a09a0..5528efe36339 100644 --- a/src/util/Util.js +++ b/src/util/Util.js @@ -500,7 +500,7 @@ class Util extends null { * @private */ static setPosition(item, position, relative, sorted, route, reason) { - let updatedItems = sorted.array(); + let updatedItems = [...sorted.values()]; Util.moveElementInArray(updatedItems, item, position, relative); updatedItems = updatedItems.map((r, i) => ({ id: r.id, position: i })); return route.patch({ data: updatedItems, reason }).then(() => updatedItems);