From e884738f424dd9496497ce525d1a2deb04ccc2f7 Mon Sep 17 00:00:00 2001 From: Vendicated Date: Mon, 28 Nov 2022 23:01:04 +0100 Subject: [PATCH] MemberCount: Fix misleading count, add tooltip --- src/plugins/memberCount.tsx | 71 ++++++++++++++++++++++--------------- 1 file changed, 42 insertions(+), 29 deletions(-) diff --git a/src/plugins/memberCount.tsx b/src/plugins/memberCount.tsx index db0a34a93..c016dff75 100644 --- a/src/plugins/memberCount.tsx +++ b/src/plugins/memberCount.tsx @@ -22,7 +22,7 @@ import { Devs } from "@utils/constants"; import { getCurrentChannel } from "@utils/discord"; import { useForceUpdater } from "@utils/misc"; import definePlugin from "@utils/types"; -import { FluxDispatcher } from "@webpack/common"; +import { FluxDispatcher, Tooltip } from "@webpack/common"; const counts = {} as Record; let forceUpdate: () => void; @@ -49,33 +49,41 @@ function MemberCount() { alignContent: "center", gap: 0 }}> -
- - {c[1]} -
-
- - {total} -
+ + {props => ( +
+ + {c[1]} +
+ )} +
+ + {props => ( +
+ + {total} +
+ )} +
); } @@ -93,7 +101,12 @@ export default definePlugin({ } }], - onGuildMemberListUpdate({ guildId, groups, memberCount }) { + onGuildMemberListUpdate({ guildId, groups, memberCount, id }) { + // eeeeeh - sometimes it has really wrong counts??? like 10 times less than actual + // but if we only listen to everyone updates, sometimes we never get the count? + // this seems to work but isn't optional + if (id !== "everyone" && counts[guildId]) return; + let count = 0; for (const group of groups) { if (group.id !== "offline")