change filter logic

This commit is contained in:
ITOH
2021-07-08 19:54:55 +02:00
parent 5f66c7950d
commit ea0673c259
3 changed files with 44 additions and 29 deletions
+6 -4
View File
@@ -1,6 +1,8 @@
import { cacheHandlers } from "../../cache.ts";
import { cache } from "../../cache.ts";
/** Gets an array of all the channels ids that are the children of this category. */
export async function categoryChildren(id: bigint) {
return await cacheHandlers.filter("channels", (channel) => channel.parentId === id);
/** Gets an array of all the channels ids that are the children of this category.
* ⚠️ This does not work for custom cache users!
*/
export function categoryChildren(parentChannelId: bigint) {
return cache.channels.filter((channel) => channel.parentId === parentChannelId);
}