feat: better user counting

This commit is contained in:
Naomi Carrigan 2024-08-13 09:05:33 -07:00
parent 37879b6e49
commit 17c2cf3a8d
Signed by: naomi
SSH Key Fingerprint: SHA256:rca1iUI2OhAM6n4FIUaFcZcicmri0jgocqKiTTAfrt8

View File

@ -28,7 +28,12 @@ export class Prometheus {
name: "users",
help: "The number of users the bot knows."
});
this.users.set(bot.users.cache.size);
this.users.set(
bot.guilds.cache.reduce(
(members, guild) => members + guild.memberCount,
0
)
);
this.errors = new Counter({
name: "errors",
help: "The number of errors handled by the process."
@ -45,7 +50,12 @@ export class Prometheus {
}
public updateUsers(bot: ExtendedClient) {
this.users.set(bot.users.cache.size);
this.users.set(
bot.guilds.cache.reduce(
(members, guild) => members + guild.memberCount,
0
)
);
}
public async updateEntitlements(bot: ExtendedClient) {