diff options
author | IRONM00N <64110067+IRONM00N@users.noreply.github.com> | 2021-09-05 13:45:44 -0400 |
---|---|---|
committer | IRONM00N <64110067+IRONM00N@users.noreply.github.com> | 2021-09-05 13:45:44 -0400 |
commit | 81d69f983983ac71dbdbd5f13e2f2d8ddc35dced (patch) | |
tree | 6a06124a6696bb4036607d179972aa889b7b3769 /src/commands/info | |
parent | 93e8fce44ec1dd3294b1c785d93d3f8b00ee4cef (diff) | |
download | tanzanite-81d69f983983ac71dbdbd5f13e2f2d8ddc35dced.tar.gz tanzanite-81d69f983983ac71dbdbd5f13e2f2d8ddc35dced.tar.bz2 tanzanite-81d69f983983ac71dbdbd5f13e2f2d8ddc35dced.zip |
cleaning up and some imporvements to the stats command
Diffstat (limited to 'src/commands/info')
-rw-r--r-- | src/commands/info/botInfo.ts | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/commands/info/botInfo.ts b/src/commands/info/botInfo.ts index 37a63ce..45c3dd8 100644 --- a/src/commands/info/botInfo.ts +++ b/src/commands/info/botInfo.ts @@ -1,5 +1,7 @@ import { BushCommand, BushMessage, BushSlashMessage } from '@lib'; import { MessageEmbed, version as discordJSVersion } from 'discord.js'; +import * as os from 'os'; +import prettyBytes from 'pretty-bytes'; export default class BotInfoCommand extends BushCommand { public constructor() { @@ -18,6 +20,19 @@ export default class BotInfoCommand extends BushCommand { } public override async exec(message: BushMessage | BushSlashMessage): Promise<void> { + enum Platform { + aix = 'AIX', + android = 'Android', + darwin = 'MacOS', + freebsd = 'FreeBSD', + linux = 'Linux', + openbsd = 'OpenBSD', + sunos = 'SunOS', + win32 = 'Windows', + cygwin = 'Cygwin', + netbsd = 'NetBSD' + } + const developers = (await util.mapIDs(client.config.owners)).map((u) => u?.tag).join('\n'); const currentCommit = (await util.shell('git rev-parse HEAD')).stdout.replace('\n', ''); let repoUrl = (await util.shell('git remote get-url origin')).stdout.replace('\n', ''); @@ -25,6 +40,19 @@ export default class BotInfoCommand extends BushCommand { const embed = new MessageEmbed() .setTitle('Bot Info:') .addField('**Uptime**', util.humanizeDuration(client.uptime!), true) + .addField( + '**Memory Usage**', + `System: ${prettyBytes(os.totalmem() - os.freemem(), { binary: true })}/${prettyBytes(os.totalmem(), { + binary: true + })}\nHeap: ${prettyBytes(process.memoryUsage().heapUsed, { binary: true })}/${prettyBytes( + process.memoryUsage().heapTotal, + { binary: true } + )}`, + true + ) + .addField('**CPU Usage**', `${client.stats.cpu}%`, true) + .addField('**Platform**', Platform[process.platform], true) + .addField('**Commands Used**', `${client.stats.commandsUsed}`, true) .addField('**Servers**', client.guilds.cache.size.toLocaleString(), true) .addField('**Users**', client.users.cache.size.toLocaleString(), true) .addField('**Discord.js Version**', discordJSVersion, true) |