Merge #23

Merged
Sirherobrine23 merged 6 commits from main into stable 2021-02-02 03:25:55 +00:00
4 changed files with 1528 additions and 35 deletions
Showing only changes of commit 0f64e443e8 - Show all commits

View File

@@ -1,36 +1,41 @@
const si = require("systeminformation");
setInterval(() => {
si.cpu().then(data => {module.exports.cpu_speed = Math.trunc(data.speed)})
si.mem().then(data => {
module.exports.ram_free = Math.trunc(data.free / 1024 / 1024 / 1024);
module.exports.ram_total = Math.trunc(data.total / 1024 / 1024 / 1024);
})
si.currentLoad().then(data => {
module.exports.current_cpu = Math.trunc(data.currentload)
})
module.exports.current_cpu = undefined
module.exports.ram_free = undefined
module.exports.ram_total = undefined
module.exports.cpu_speed = undefined
module.exports.bds_cpu = undefined
// module.exports.system = si
}, 1000);
function init_1(){
si.cpu().then(data => {
module.exports.cpu_speed = Math.trunc(data.speed)
})
si.mem().then(data => {
module.exports.ram_free = Math.trunc(data.free / 1024 / 1024 / 1024)
module.exports.ram_total = Math.trunc(data.total / 1024 / 1024 / 1024)
})
si.currentLoad().then(data => {
module.exports.current_cpu = Math.trunc(data.currentLoad)
})
}
function init_2(){
si.processes().then(data => {
const list = data.list
for (let pid in list) {
var pids = list[pid].command
if (pids.includes("server")){
module.exports.bds_cpu = Math.trunc(list[pid].pcpu)
if (pids.includes("server.")){
module.exports.bds_cpu = Math.trunc(list[pid].cpu)
} else {
pid++
}
}
})
setInterval(() => {
si.processes().then(data => {
const list = data.list
for (let pid in list) {
var pids = list[pid].command
if (pids.includes("server")){
module.exports.bds_cpu = Math.trunc(list[pid].pcpu)
} else {
pid++
}
}
})
}, 3000);
}
init_1()
init_2()
setInterval(() => {
init_1()
init_2()
}, 3000);

View File

@@ -84,16 +84,15 @@ bot.command("list", (ctx) =>{
}
});
bot.command("mcpe", (ctx) =>{
// ctx.replyWithHTML(`<a href="https://storage.cloud.google.com/bds_mcpe_files/mcpe.apk">Minecraft for Android 1.16.201.01</a>`)
const text = `[Minecraft for Android 1.16.201.01](https://files.sh33.org/mcpe/latest.sonic)
ctx.replyWithMarkdown(`[Minecraft for Android 1.16.201.01](https://files.sh33.org/mcpe/latest.sonic)
Iphone users are not privileged
`
ctx.replyWithMarkdown(text)
});
`)});
bot.command("status", (ctx) =>{
const status = require("./system_monitor")
const text = `Bds CPU usage: ${bds_cpu}%, Total CPU utilization: ${current_cpu}%\n\n\nTotal ram memory: ${ram_total} GB, Total free ram memory: ${ram_free} GB`
const {bds_cpu, current_cpu, ram_total, ram_free} = require("./system_monitor")
const text = `Bds CPU usage: ${bds_cpu}%, Total CPU utilization: ${current_cpu}%
Total ram memory: ${ram_total} GB, Total free ram memory: ${ram_free} GB`
ctx.replyWithMarkdown(text);
});
bot.command("log", (ctx) => {

1493
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,6 @@
{
"name": "bds_maneger_api",
"version": "1.5.0",
"version": "1.5.2",
"description": "scripts to manage minecraft bedrock server",
"private": false,
"main": "index.js",