Skip to content
This repository was archived by the owner on Oct 16, 2024. It is now read-only.

Commit 6244389

Browse files
committed
fix(info): good stats now
1 parent 72e76f0 commit 6244389

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed

src/commands/info.ts

+14-8
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class InfoCommand extends Command {
2525
},
2626
};
2727

28-
const data: { status: string; id: number; cluster: number }[][] = await this.bot.cluster.broadcastEval(
28+
const shardData: { status: string; id: number; cluster: number }[][] = await this.bot.cluster.broadcastEval(
2929
"this.shards.map(x => { return { status: x.status, id: x.id, cluster: this.cluster.id } })"
3030
);
3131

@@ -47,17 +47,23 @@ class InfoCommand extends Command {
4747
},
4848
{
4949
name: ":tools: Servers",
50-
value: "```" + this.client.guilds.size + "```",
50+
value: "```" + (await this.bot.cluster.fetchClientValues("guilds.size")).reduce((a, b) => a + b, 0) + "```",
5151
inline: true,
5252
},
5353
{
5454
name: ":busts_in_silhouette: Members",
55-
value: "```" + this.client.guilds.map(g => g.memberCount).reduce((a: number, b: number) => a + b, 0) + "```",
55+
value: "```" + (await this.bot.cluster.fetchClientValues("users.size")).reduce((a, b) => a + b, 0) + "```",
5656
inline: true,
5757
},
5858
{
5959
name: "<:channel:1026072967794413580> Channels",
60-
value: "```" + Object.keys(this.client.channelGuildMap).length + "```",
60+
value:
61+
"```" +
62+
(await this.bot.cluster.broadcastEval("Object.keys(this.channelGuildMap).length")).reduce(
63+
(a, b) => a + b,
64+
0
65+
) +
66+
"```",
6167
inline: true,
6268
},
6369
{
@@ -73,13 +79,13 @@ class InfoCommand extends Command {
7379
this.client.shards.filter(x => x.status === "ready" || x.status === "resuming").length
7480
}` +
7581
`\n` +
76-
`All Clusters: ${data.map(x => x.length).reduce((a, b) => a + b, 0)}` +
82+
`All Clusters: ${shardData.map(x => x.length).reduce((a, b) => a + b, 0)}` +
7783
` ` +
78-
`Online: ${data.map(x => x.filter(y => y.status === "ready").length).reduce((a, b) => a + b, 0)}` +
84+
`Online: ${shardData.map(x => x.filter(y => y.status === "ready").length).reduce((a, b) => a + b, 0)}` +
7985
` ` +
8086
`Offline: ${
81-
data.map(x => x.length).reduce((a, b) => a + b, 0) -
82-
data
87+
shardData.map(x => x.length).reduce((a, b) => a + b, 0) -
88+
shardData
8389
.map(x => x.filter(y => y.status === "ready" || y.status === "resuming").length)
8490
.reduce((a, b) => a + b, 0)
8591
}` +

0 commit comments

Comments
 (0)