CPU assign to Glitch

Great news! Just contacted Glitch support and they replied! I’m using pidusage, and it’s awesome!

Here is the code for anyone else!! (I know that I should be using a command processor instead. I’ll migrate to that in the future.

client.on("message", message => {
  if (message.content == "m!stats") {
    pidusage(process.pid, function (err, stats) {
      message.channel.send("CPU: " + stats.cpu + "%\nMemory Usage: " + stats.memory + " bytes");
    })
  }
});

Just make sure to remember to put var pidusage = require('pidusage') at the start of the code!

Thanks everyone that helped! Really love Glitch’s community (nohomo)

3 Likes