discordstatusmodules/modules/cputemp.js
2021-11-01 12:30:21 +01:00

11 lines
467 B
JavaScript

// This module is only confirmed to work on linux. You might need to change "sensor".
const sensor = "Core 0";
const child_process = require("child_process");
module.exports = function (storage, callback) {
child_process.spawnSync("sensors").stdout.toString().split("\n").forEach(function(line) {
if (line.startsWith(sensor + ":")) {
callback(line.replace(/\s{1,}/g, " ").substr(sensor.length + 2, line.length - (sensor.length + 2)).split(" ")[0]);
};
});
}