forked from 3ddelano/pc-statbot
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added modular components for the bot, with component scoped enabling
- Loading branch information
Showing
7 changed files
with
114 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
module.exports = { | ||
"env": { | ||
"node": true, | ||
"es6": true | ||
}, | ||
"extends": "eslint:recommended", | ||
"parserOptions": { | ||
"ecmaVersion": 2018 | ||
}, | ||
"rules": { | ||
"indent": [ | ||
"error", | ||
4 | ||
], | ||
"linebreak-style": [ | ||
"error", | ||
"unix" | ||
], | ||
"quotes": [ | ||
"error", | ||
"single" | ||
], | ||
"semi": [ | ||
"error", | ||
"always" | ||
], | ||
"no-console": "off" | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
const info = require("systeminformation"); | ||
exports.update = async () => { | ||
let batteryData = await info.battery(); | ||
let payload = ':battery: **Battery:**: No battery found.' | ||
if (batteryData.hasBattery) { | ||
payload = `:battery: **Battery:** ${batteryData.percent}% ${batteryData.isCharging ? '(Charging)' : '(Not Charging)'}`; | ||
} | ||
return payload; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
const info = require("systeminformation"); | ||
exports.update = async () => { | ||
const currentLoad = (await info.currentLoad().then(data => data.currentLoad)).toFixed(2); | ||
|
||
const payload = `:gear: **CPU Usage:** ${currentLoad}%`; | ||
return payload; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
const os = require("os"); | ||
const conversionFactor = 9.3132 * 1e-10; | ||
|
||
exports.update = async () => { | ||
|
||
let totalMem = (os.totalmem() * conversionFactor).toFixed(2); | ||
let usedMem = (totalMem - (os.freemem() * conversionFactor)).toFixed(2); | ||
|
||
let payload = `:tools: **Memory Usage:** ${usedMem} GB / ${totalMem} GB`; | ||
return payload; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,10 @@ | ||
{ | ||
"token": "token from bot section of discord developer page", | ||
"clientID": "client id from oauth2 section of discord developer page" | ||
"interval": 30 | ||
"clientID": "client id from oauth2 section of discord developer page", | ||
"interval": 30, | ||
"components": { | ||
"battery": true, | ||
"cpuUsage": true, | ||
"memoryUsage": true | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters