Merge #23
@@ -1,36 +1,41 @@
|
||||
const si = require("systeminformation");
|
||||
setInterval(() => {
|
||||
si.cpu().then(data => {module.exports.cpu_speed = Math.trunc(data.speed)})
|
||||
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
|
||||
|
||||
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);
|
||||
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 = Math.trunc(data.currentLoad)
|
||||
})
|
||||
}
|
||||
|
||||
}, 1000);
|
||||
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++
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
init_1()
|
||||
init_2()
|
||||
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++
|
||||
}
|
||||
}
|
||||
})
|
||||
init_1()
|
||||
init_2()
|
||||
}, 3000);
|
||||
|
@@ -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
1493
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -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",
|
||||
|
Reference in New Issue
Block a user