From 1b3443561d62f1621dca04f0421704023e81f13b Mon Sep 17 00:00:00 2001 From: Reinhardt Date: Mon, 29 Aug 2022 18:44:03 +0700 Subject: [PATCH] Add current server and user counts --- framework/lib/Commands/Modules/StatsCommand.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/framework/lib/Commands/Modules/StatsCommand.ts b/framework/lib/Commands/Modules/StatsCommand.ts index 73d71d9..a2037c2 100644 --- a/framework/lib/Commands/Modules/StatsCommand.ts +++ b/framework/lib/Commands/Modules/StatsCommand.ts @@ -6,10 +6,14 @@ import { Util } from "../../Utils"; import osUtils from "os-utils"; import os from "os"; import packageJson from "../../../package.json"; +import { setTimeout } from "node:timers/promises"; export async function statsCommand(client: NReaderClient, interaction: CommandInteraction) { const memory: number = process.memoryUsage().rss; + await interaction.defer(); + await setTimeout(2000); + const totalMemory = `${Util.bytesToSize(memory).value}${Util.bytesToSize(memory).unit} / ${Util.bytesToSize(os.totalmem()).value}${Util.bytesToSize(os.totalmem()).unit}`; const totalMem = Util.bytesToSize(os.totalmem()).value * 1000 ; const used: number = process.memoryUsage().rss / totalMem / totalMem; @@ -29,8 +33,8 @@ export async function statsCommand(client: NReaderClient, interaction: CommandIn .addField("NodeJS", `${process.versions.node}`, true) .addField("Eris", `${VERSION}`, true) .addField("API", packageJson.dependencies["nhentai-api"].replace("^", ""), true) - .addField(client.translate("general.stats.server"), guildData.length.toLocaleString(), true) - .addField(client.translate("general.stats.user"), userData.length.toLocaleString(), true) + .addField(client.translate("general.stats.server"), `${guildData.length.toLocaleString()} (${client.guilds.size.toLocaleString()})`, true) + .addField(client.translate("general.stats.user"), `${userData.length.toLocaleString()} (${client.users.size.toLocaleString()})`, true) .addField(client.translate("general.stats.platform"), `${process.platform.charAt(0).toUpperCase() + process.platform.slice(1)}`, true); return interaction.createMessage({