SHARE
TWEET

Untitled

a guest Nov 16th, 2019 86 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const Discord = require("discord.js")
  2. const os = require('os')
  3. const cpuStat = require("cpu-stat");
  4. const moment = require("moment")
  5.  
  6.  
  7. exports.run = async (bot, message, args) => {
  8.   message.delete()
  9.  
  10.            let { version } = require("discord.js");
  11.    
  12.            cpuStat.usagePercent(function(err, percent, seconds) {
  13.              if (err) {
  14.                return console.log(err);
  15.              }
  16.            
  17.             let secs = Math.floor(bot.uptime % 90);
  18.             let days = Math.floor((bot.uptime % 31536000) / 86400);
  19.             let hours = Math.floor((bot.uptime / 3600) % 24);
  20.             let mins = Math.floor((bot.uptime / 60) % 60);
  21.              let embedStats = new Discord.RichEmbed()
  22.             .setTitle("*** Stats ***")
  23.             .setColor(`RANDOM`)
  24.             .addField("• Mem Usage", `${(process.memoryUsage().heapUsed / 1024 / 1024).toFixed(2)} / ${(os.totalmem() / 1024 / 1024).toFixed(2)} MB`, true)
  25.             .addField("• Uptime ", `${hours}h ${mins}m`, true) //`${duration}`, true)
  26.             .addField("• Users", `${bot.users.size.toLocaleString()}`, true)
  27.             .addField("• Servers", `${bot.guilds.size.toLocaleString()}`, true)
  28.             .addField("• Channels ", `${bot.channels.size.toLocaleString()}`, true)
  29.             .addField("• Discord.js", `v${version}`, true)
  30.             .addField("• CPU", `\`\`\`md\n${os.cpus().map(i => `${i.model}`)[0]}\`\`\``)
  31.             .addField("• CPU usage", `\`${percent.toFixed(2)}%\``,true)
  32.             .addField("• Arch", `\`${os.arch()}\``,true)
  33.             .addField("• Platform", `\`\`${os.platform()}\`\``,true)
  34.             .setFooter("Dash Bot Stats")
  35.    
  36.             const msg = await message.channel.send(embedStats)
  37.  
  38.             setInterval(() => {
  39.               await msg.edit(embedStats)
  40.             }, 2000)
  41.  
  42.             })
  43.  
  44.  
  45. }
  46.  
  47.    module.exports.help = {
  48.        name: "stats"
  49.    }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top