Skip to content

Commit

Permalink
fix: array/keyArray removed (#6245)
Browse files Browse the repository at this point in the history
  • Loading branch information
1Computer1 committed Jul 31, 2021
1 parent 797727a commit bf221f2
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/structures/GuildChannel.js
Expand Up @@ -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));
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/structures/Role.js
Expand Up @@ -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));
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/structures/interfaces/TextBasedChannel.js
Expand Up @@ -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);
}
Expand Down
2 changes: 1 addition & 1 deletion src/util/Util.js
Expand Up @@ -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);
Expand Down

0 comments on commit bf221f2

Please sign in to comment.