Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ======================
- // Current proccess info
- // ======================
- exports.proc = function(data)
- {
- if (data.message.author.id !== data.config.owner)
- {
- return;
- }
- //
- // Get proccess data
- //
- const title = `**\`${process.title}\`** `;
- const pid = `**\`#${process.pid}\`** `;
- const platform = `**\`${process.platform}\`** `;
- //
- // Get shard info
- //
- let shard = data.message.client.shard;
- if (!shard)
- {
- shard = {
- id: 0,
- count: 1
- };
- }
- //
- // Byte formatter (mb/gb)
- //
- const byteFormat = function(bytes)
- {
- if (bytes > 750000000)
- {
- const gb = bytes / 1000 / 1000 / 1000;
- return gb.toFixed(3) + " gb";
- }
- const mb = bytes / 1000 / 1000;
- return mb.toFixed(2) + " mb";
- };
- //
- // Get memory usage
- //
- const memory = process.memoryUsage();
- const memoryFormat = oneLine`
- **\`${byteFormat(memory.rss)}\`** \`rss\` ยท
- **\`${byteFormat(memory.heapUsed)}\`**\`/\`
- **\`${byteFormat(memory.heapTotal)}\`** \`heap\` ยท
- **\`${byteFormat(memory.external)}\`** \`external\`
- `;
- //
- // Get CPU usage
- //
- const cpu = process.cpuUsage();
- //
- // Get proccess/shard uptime
- //
- const procUptime = secConverter(Math.round(process.uptime()), "sec");
- const shardUptime = secConverter(data.message.client.uptime);
- const uptimeFormat = function(uptime)
- {
- return oneLine`
- **\`${uptime.days}\`** days
- **\`${uptime.hours}:${uptime.minutes}:${uptime.seconds}\`**
- `;
- };
- //
- // Render message
- //
- data.text = stripIndent`
- :robot: Process: ${title + pid + platform}
- :control_knobs: RAM: ${memoryFormat}
- :control_knobs: CPU: **\`${cpu}%\`**
- :stopwatch: Proc Uptime: ${uptimeFormat(procUptime)}
- :stopwatch: Shard Uptime: ${uptimeFormat(shardUptime)}
- :pager: Current Shard: **\`${shard.id + 1} / ${shard.count}\`**
- `;
- //
- // Send message
- //
- botSend(data);
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement