summaryrefslogtreecommitdiff
path: root/src/commands/utility/memorystats.ts
blob: 43dbd132e1ab30c0a4a15921355eee6252b9a11b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import { Command, CommandoMessage } from 'discord.js-commando';

module.exports = class MemoryStatsUtility extends Command {
    constructor(client) {
        super(client, {
            name: 'memorystats',
            aliases: [
                'memstats',
                'mem-stats',
                'memory-stats',
                'memorystats',
                'memstat',
                'mem-stat',
                'memory-stat',
                'memorystat'
            ],
            group: 'utility',
            memberName: 'memorystats',
            description: 'Checks the full, current, approximate memory usage statistics of the bot\'s Node.js process.',
        });
    }
    run(msg: CommandoMessage) {
        const used = process.memoryUsage();
        msg.reply(`The full, current, approximate memory usage statistics are currentaly;
\`\`\`js
rss: ${Math.round(used.rss / 1024 / 1024 * 100) / 100} MBs
heapTotal: ${Math.round(used.heapTotal / 1024 / 1024 * 100) / 100} MBs
heapUsed: ${Math.round(used.heapUsed / 1024 / 1024 * 100) / 100} MBs
external: ${Math.round(used.external / 1024 / 1024 * 100) / 100} MBs
\`\`\``)
    }
};