_🐰` rabbiteatters `🐇_🍰🍮🍩
_🐰` rabbiteatters `🐇_🍰🍮🍩
DIAdiscord.js - Imagine an app
Created by _🐰` rabbiteatters `🐇_🍰🍮🍩 on 7/29/2023 in #djs-questions
Help with collection filter
I am trying to filter out threads which has been locked or archived, but it just return the whole collection back.
const forum = await client.channels.fetch(channel);
let threads = forum.threads.cache;
...
let fetchedThreads = threads;
do {
fetchedThreads = (await forum.threads.fetchArchived({before: fetchedThreads.last(), limit: 100})).threads;
} while ( fetchedThreads && fetchedThreads.size != 0 )
threads = forum.threads.cache.filter(thread => thread.locked == false && thread.archived == false);
const forum = await client.channels.fetch(channel);
let threads = forum.threads.cache;
...
let fetchedThreads = threads;
do {
fetchedThreads = (await forum.threads.fetchArchived({before: fetchedThreads.last(), limit: 100})).threads;
} while ( fetchedThreads && fetchedThreads.size != 0 )
threads = forum.threads.cache.filter(thread => thread.locked == false && thread.archived == false);
2 replies