Plugin

MemberCount

Shows the number of online members, total members, and users in voice channels on the server — in the member list and tooltip.

Servers Utility
index.tsx
Download

Source

src/plugins/memberCount/index.tsx
1/*
2 * FiveCord — a Discord client mod
3 * Copyright (c) 2025 FiveCord
4 * SPDX-License-Identifier: GPL-3.0-or-later
5 */
6
7import "./style.css";
8
9import { definePluginSettings } from "@api/Settings";
10import ErrorBoundary from "@components/ErrorBoundary";
11import { Devs } from "@utils/constants";
12import { classNameFactory } from "@utils/css";
13import definePlugin, { OptionType } from "@utils/types";
14import { FluxStore } from "@vencord/discord-types";
15import { findStoreLazy } from "@webpack";
16
17import { MemberCount } from "./MemberCount";
18
19export const ChannelMemberStore = findStoreLazy("ChannelMemberStore") as FluxStore & {
20 getProps(guildId?: string, channelId?: string): { groups: { count: number; id: string; }[]; };
21};
22export const ThreadMemberListStore = findStoreLazy("ThreadMemberListStore") as FluxStore & {
23 getMemberListSections(channelId?: string): { [sectionId: string]: { sectionId: string; userIds: string[]; }; };
24};
25
26export const settings = definePluginSettings({
27 toolTip: {
28 type: OptionType.BOOLEAN,
29 description: "Show member count on the server tooltip",
30 default: true,
31 restartNeeded: true
32 },
33 memberList: {
34 type: OptionType.BOOLEAN,
35 description: "Show member count in the member list",
36 default: true,
37 restartNeeded: true
38 },
39 voiceActivity: {
40 type: OptionType.BOOLEAN,
41 description: "Show voice activity with member count in the member list",
42 default: true
43 }
44});
45
46const sharedIntlNumberFormat = new Intl.NumberFormat();
47export const numberFormat = (value: number) => sharedIntlNumberFormat.format(value);
48export const cl = classNameFactory("vc-membercount-");
49
50export default definePlugin({
51 name: "MemberCount",
52 description: "Shows the number of online members, total members, and users in voice channels on the server — in the member list and tooltip.",
53 tags: ["Servers", "Utility"],
54 authors: [Devs.Ven, Devs.Commandtechno, Devs.Apexo],
55 settings,
56
57 patches: [
58 {
59 find: "{isSidebarVisible:",
60 replacement: [
61 {
62 match: /children:\[(\i\.useMemo[^}]+"aria-multiselectable")(?<=className:(\i),.+?)/,
63 replace: "children:[$2?.includes(&#039;members&#039;)?$self.render():null,$1",
64 },
65 ],
66 predicate: () => settings.store.memberList
67 },
68 {
69 find: "GuildTooltip - ",
70 replacement: {
71 match: /#{intl::VIEW_AS_ROLES_MENTIONS_WARNING}.{0,100}(?=])/,
72 replace: "$&,$self.renderTooltip(arguments[0].guild)"
73 },
74 predicate: () => settings.store.toolTip
75 }
76 ],
77 render: ErrorBoundary.wrap(() => <MemberCount />, { noop: true }),
78 renderTooltip: ErrorBoundary.wrap(guild => <MemberCount isTooltip tooltipGuildId={guild.id} />, { noop: true })
79});
80