Files
discord-decomp/modules/directory_channels/GuildDirectoryUtils.tsx
T
2026-11-01 12:12:55 +02:00

47 lines
1.6 KiB
TypeScript

// Metro module 10056 (f10057).
import { DirectoryEntryTypes } from "./GuildDirectoryConstants";
import Module38 from "../../_bundle/Module38";
import Module12 from "../../_bundle/Module12";
function $mk83845() {
return (a0) => a0.approximateMemberCount;
}
function $mk83846() {
return (a0) => a0.createdAt;
}
export function guildDirectoryEntryFromServer(a0) {
if (a0.type === DirectoryEntryTypes.GUILD) {
const name = a0.guild?.name;
return {
channelId: a0.directory_channel_id,
guildId: a0.entity_id,
type: a0.type,
authorId: a0.author_id,
createdAt: a0.created_at,
description: a0.description,
primaryCategoryId: a0.primary_category_id,
name,
icon: a0.guild?.icon,
splash: a0.guild?.splash,
features: new Set(a0.guild?.features),
approximateMemberCount: a0.guild?.approximate_member_count,
approximatePresenceCount: a0.guild?.approximate_presence_count,
featurableInDirectory: a0.guild?.featurable_in_directory
};
}
a0.type;
Module38(false, "Directory entries must be connected to a guild!");
}
export const MAX_CATEGORY_SERVERS = 5;
export function orderByTotalMemberCount(a0) {
return Module12.orderBy(a0, [$mk83845()], ["desc"]);
}
export function orderByDateAdded(a0) {
return Module12.orderBy(a0, [$mk83846()], ["desc"]);
}
export function rankByDateAdded(a0) {
return Module12.orderBy(a0.filter((item) => item.featurableInDirectory), [$mk83846()], ["desc"]).slice(0, 5);
}
export function rankGuildEntries(a0) {
return Module12.orderBy(a0, [$mk83845()], ["desc"]);
}