Add more info about the server its running on
This commit is contained in:
parent
fc8379d887
commit
e300acc0f2
1 changed files with 17 additions and 0 deletions
|
@ -1,6 +1,8 @@
|
|||
const { Command } = require('discord-akairo');
|
||||
const akairoVersion = require('discord-akairo').version;
|
||||
const { MessageEmbed, version } = require('discord.js');
|
||||
const util = require('util');
|
||||
const exec = util.promisify(require('child_process').exec);
|
||||
|
||||
class StatsCommand extends Command {
|
||||
constructor() {
|
||||
|
@ -35,6 +37,19 @@ class StatsCommand extends Command {
|
|||
|
||||
const used = process.memoryUsage().heapUsed / 1024 / 1024;
|
||||
|
||||
// Get cpu model
|
||||
let cpu;
|
||||
if (process.platform == 'darwin') {
|
||||
const { stdout } = await exec('sysctl -n machdep.cpu.brand_string');
|
||||
cpu = stdout;
|
||||
} else if (process.platform == 'linux') {
|
||||
const { stdout } = await exec('grep -m 1 \'model name\' /proc/cpuinfo');
|
||||
cpu = stdout;
|
||||
} else if (process.platform == 'win32') {
|
||||
const { stdout } = await exec('wmic CPU get NAME');
|
||||
cpu = stdout;
|
||||
}
|
||||
|
||||
const statsEmbed = new MessageEmbed()
|
||||
.setColor('#0099ff')
|
||||
.setTitle('Bot stats')
|
||||
|
@ -44,6 +59,8 @@ class StatsCommand extends Command {
|
|||
.addField('Users', this.client.users.size, true)
|
||||
.addField('Uptime', dateString, true)
|
||||
.addField('Ram usage', `${Math.round(used * 100) / 100} MB`, true)
|
||||
.addField('CPU', cpu, true)
|
||||
.addField('OS', process.platform, true)
|
||||
.addField('Nodejs version', process.version, true)
|
||||
.addField('Discord.js version', version, true)
|
||||
.addField('Discord-Akairo version', akairoVersion, true)
|
||||
|
|
Loading…
Reference in a new issue