aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVendicated <vendicated@riseup.net>2022-11-28 23:01:04 +0100
committerVendicated <vendicated@riseup.net>2022-11-28 23:01:09 +0100
commite884738f424dd9496497ce525d1a2deb04ccc2f7 (patch)
tree2b7e4cb5243219d8ced4ff3f0e202aadd7276e72
parentc583bad6bf7206bec077c4706e0d55bc930fa5bf (diff)
downloadVencord-e884738f424dd9496497ce525d1a2deb04ccc2f7.tar.gz
Vencord-e884738f424dd9496497ce525d1a2deb04ccc2f7.tar.bz2
Vencord-e884738f424dd9496497ce525d1a2deb04ccc2f7.zip
MemberCount: Fix misleading count, add tooltip
-rw-r--r--src/plugins/memberCount.tsx71
1 files changed, 42 insertions, 29 deletions
diff --git a/src/plugins/memberCount.tsx b/src/plugins/memberCount.tsx
index db0a34a..c016dff 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<string, [number, number]>;
let forceUpdate: () => void;
@@ -49,33 +49,41 @@ function MemberCount() {
alignContent: "center",
gap: 0
}}>
- <div>
- <span
- style={{
- backgroundColor: "var(--status-green-600)",
- width: "12px",
- height: "12px",
- borderRadius: "50%",
- display: "inline-block",
- marginRight: "0.5em"
- }}
- />
- <span style={{ color: "var(--status-green-600)" }}>{c[1]}</span>
- </div>
- <div>
- <span
- style={{
- width: "6px",
- height: "6px",
- borderRadius: "50%",
- border: "3px solid var(--status-grey-500)",
- display: "inline-block",
- marginRight: "0.5em",
- marginLeft: "1em"
- }}
- />
- <span style={{ color: "var(--status-grey-500)" }}>{total}</span>
- </div>
+ <Tooltip text={`${c[1]} Online`} position="bottom">
+ {props => (
+ <div {...props}>
+ <span
+ style={{
+ backgroundColor: "var(--status-green-600)",
+ width: "12px",
+ height: "12px",
+ borderRadius: "50%",
+ display: "inline-block",
+ marginRight: "0.5em"
+ }}
+ />
+ <span style={{ color: "var(--status-green-600)" }}>{c[1]}</span>
+ </div>
+ )}
+ </Tooltip>
+ <Tooltip text={`${c[0] || "?"} Total Members`} position="bottom">
+ {props => (
+ <div {...props}>
+ <span
+ style={{
+ width: "6px",
+ height: "6px",
+ borderRadius: "50%",
+ border: "3px solid var(--status-grey-500)",
+ display: "inline-block",
+ marginRight: "0.5em",
+ marginLeft: "1em"
+ }}
+ />
+ <span style={{ color: "var(--status-grey-500)" }}>{total}</span>
+ </div>
+ )}
+ </Tooltip>
</Flex>
);
}
@@ -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")