Merge #23
@@ -1,36 +1,41 @@
|
|||||||
const si = require("systeminformation");
|
const si = require("systeminformation");
|
||||||
setInterval(() => {
|
module.exports.current_cpu = undefined
|
||||||
si.cpu().then(data => {module.exports.cpu_speed = Math.trunc(data.speed)})
|
module.exports.ram_free = undefined
|
||||||
si.mem().then(data => {
|
module.exports.ram_total = undefined
|
||||||
module.exports.ram_free = Math.trunc(data.free / 1024 / 1024 / 1024);
|
module.exports.cpu_speed = undefined
|
||||||
module.exports.ram_total = Math.trunc(data.total / 1024 / 1024 / 1024);
|
module.exports.bds_cpu = undefined
|
||||||
})
|
// module.exports.system = si
|
||||||
si.currentLoad().then(data => {
|
|
||||||
module.exports.current_cpu = Math.trunc(data.currentload)
|
|
||||||
})
|
|
||||||
|
|
||||||
}, 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 => {
|
si.processes().then(data => {
|
||||||
const list = data.list
|
const list = data.list
|
||||||
for (let pid in list) {
|
for (let pid in list) {
|
||||||
var pids = list[pid].command
|
var pids = list[pid].command
|
||||||
if (pids.includes("server")){
|
if (pids.includes("server.")){
|
||||||
module.exports.bds_cpu = Math.trunc(list[pid].pcpu)
|
module.exports.bds_cpu = Math.trunc(list[pid].cpu)
|
||||||
} else {
|
} else {
|
||||||
pid++
|
pid++
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
setInterval(() => {
|
}
|
||||||
si.processes().then(data => {
|
|
||||||
const list = data.list
|
init_1()
|
||||||
for (let pid in list) {
|
init_2()
|
||||||
var pids = list[pid].command
|
setInterval(() => {
|
||||||
if (pids.includes("server")){
|
init_1()
|
||||||
module.exports.bds_cpu = Math.trunc(list[pid].pcpu)
|
init_2()
|
||||||
} else {
|
}, 3000);
|
||||||
pid++
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}, 3000);
|
|
||||||
|
@@ -84,16 +84,15 @@ bot.command("list", (ctx) =>{
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
bot.command("mcpe", (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>`)
|
ctx.replyWithMarkdown(`[Minecraft for Android 1.16.201.01](https://files.sh33.org/mcpe/latest.sonic)
|
||||||
const text = `[Minecraft for Android 1.16.201.01](https://files.sh33.org/mcpe/latest.sonic)
|
|
||||||
|
|
||||||
Iphone users are not privileged
|
Iphone users are not privileged
|
||||||
`
|
`)});
|
||||||
ctx.replyWithMarkdown(text)
|
|
||||||
});
|
|
||||||
bot.command("status", (ctx) =>{
|
bot.command("status", (ctx) =>{
|
||||||
const status = require("./system_monitor")
|
const {bds_cpu, current_cpu, ram_total, ram_free} = 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 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);
|
ctx.replyWithMarkdown(text);
|
||||||
});
|
});
|
||||||
bot.command("log", (ctx) => {
|
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",
|
"name": "bds_maneger_api",
|
||||||
"version": "1.5.0",
|
"version": "1.5.2",
|
||||||
"description": "scripts to manage minecraft bedrock server",
|
"description": "scripts to manage minecraft bedrock server",
|
||||||
"private": false,
|
"private": false,
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
|
Reference in New Issue
Block a user