aboutsummaryrefslogtreecommitdiff
path: root/src/plugins
diff options
context:
space:
mode:
authorVendicated <vendicated@riseup.net>2023-04-13 19:09:12 +0200
committerVendicated <vendicated@riseup.net>2023-04-13 19:10:20 +0200
commit694a693a8ec5a7a5ef6ca91ebc142e07f0fb6b61 (patch)
tree8d7183c38b6b1047ad6690073443c82902710b27 /src/plugins
parented827c2d811982628daee6a3b418d69f165465c2 (diff)
downloadVencord-694a693a8ec5a7a5ef6ca91ebc142e07f0fb6b61.tar.gz
Vencord-694a693a8ec5a7a5ef6ca91ebc142e07f0fb6b61.tar.bz2
Vencord-694a693a8ec5a7a5ef6ca91ebc142e07f0fb6b61.zip
MemberCount: Fall back to approx member count if necessary
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/memberCount.tsx6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/plugins/memberCount.tsx b/src/plugins/memberCount.tsx
index 3762614..3a68126 100644
--- a/src/plugins/memberCount.tsx
+++ b/src/plugins/memberCount.tsx
@@ -22,11 +22,14 @@ import { Devs } from "@utils/constants";
import { getCurrentChannel } from "@utils/discord";
import { useForceUpdater } from "@utils/misc";
import definePlugin from "@utils/types";
+import { findStoreLazy } from "@webpack";
import { FluxDispatcher, Tooltip } from "@webpack/common";
const counts = {} as Record<string, [number, number]>;
let forceUpdate: () => void;
+const GuildMemberCountStore = findStoreLazy("GuildMemberCountStore");
+
function MemberCount() {
const guildId = getCurrentChannel().guild_id;
const c = counts[guildId];
@@ -37,7 +40,8 @@ function MemberCount() {
let total = c[0].toLocaleString();
if (total === "0" && c[1] > 0) {
- total = "Loading...";
+ const approx = GuildMemberCountStore.getMemberCount(guildId);
+ total = approx ? approx.toLocaleString() : "Loading...";
}
const online = c[1].toLocaleString();