mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-14 02:23:31 +01:00
fix: array/keyArray removed (#6245)
This commit is contained in:
@@ -153,7 +153,7 @@ class GuildChannel extends Channel {
|
|||||||
*/
|
*/
|
||||||
get position() {
|
get position() {
|
||||||
const sorted = this.guild._sortedChannels(this);
|
const sorted = this.guild._sortedChannels(this);
|
||||||
return sorted.array().indexOf(sorted.get(this.id));
|
return [...sorted.values()].indexOf(sorted.get(this.id));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -159,7 +159,7 @@ class Role extends Base {
|
|||||||
*/
|
*/
|
||||||
get position() {
|
get position() {
|
||||||
const sorted = this.guild._sortedRoles();
|
const sorted = this.guild._sortedRoles();
|
||||||
return sorted.array().indexOf(sorted.get(this.id));
|
return [...sorted.values()].indexOf(sorted.get(this.id));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -293,7 +293,7 @@ class TextBasedChannel {
|
|||||||
*/
|
*/
|
||||||
async bulkDelete(messages, filterOld = false) {
|
async bulkDelete(messages, filterOld = false) {
|
||||||
if (Array.isArray(messages) || messages instanceof Collection) {
|
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) {
|
if (filterOld) {
|
||||||
messageIds = messageIds.filter(id => Date.now() - SnowflakeUtil.deconstruct(id).timestamp < 1209600000);
|
messageIds = messageIds.filter(id => Date.now() - SnowflakeUtil.deconstruct(id).timestamp < 1209600000);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -500,7 +500,7 @@ class Util extends null {
|
|||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
static setPosition(item, position, relative, sorted, route, reason) {
|
static setPosition(item, position, relative, sorted, route, reason) {
|
||||||
let updatedItems = sorted.array();
|
let updatedItems = [...sorted.values()];
|
||||||
Util.moveElementInArray(updatedItems, item, position, relative);
|
Util.moveElementInArray(updatedItems, item, position, relative);
|
||||||
updatedItems = updatedItems.map((r, i) => ({ id: r.id, position: i }));
|
updatedItems = updatedItems.map((r, i) => ({ id: r.id, position: i }));
|
||||||
return route.patch({ data: updatedItems, reason }).then(() => updatedItems);
|
return route.patch({ data: updatedItems, reason }).then(() => updatedItems);
|
||||||
|
|||||||
Reference in New Issue
Block a user