Merge #23
12
API/teste.js
12
API/teste.js
@ -1,12 +0,0 @@
|
|||||||
var qr = require('qr-image');
|
|
||||||
var express = require('express');
|
|
||||||
|
|
||||||
var app = express();
|
|
||||||
|
|
||||||
app.get('/', function(req, res) {
|
|
||||||
var code = qr.image(`list: ${Math.random()}`, { type: 'svg' });
|
|
||||||
res.type('svg');
|
|
||||||
code.pipe(res);
|
|
||||||
});
|
|
||||||
|
|
||||||
app.listen(3000);
|
|
@ -1,41 +1,41 @@
|
|||||||
const bds_monitor = process.env.BDS_MONI.includes("true")
|
const si = require("systeminformation");
|
||||||
if (bds_monitor){
|
module.exports.current_cpu = undefined
|
||||||
const si = require("systeminformation");
|
module.exports.ram_free = undefined
|
||||||
setInterval(() => {
|
module.exports.ram_total = undefined
|
||||||
// si.cpu().then(data => {module.exports.cpu_speed = Math.trunc(data.speed)})
|
module.exports.cpu_speed = undefined
|
||||||
si.mem().then(data => {
|
module.exports.bds_cpu = undefined
|
||||||
module.exports.ram_free = Math.trunc(data.free / 1024 / 1024 / 1024);
|
// module.exports.system = si
|
||||||
module.exports.ram_total = Math.trunc(data.total / 1024 / 1024 / 1024);
|
|
||||||
})
|
|
||||||
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("bedrock_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("bedrock_server")){
|
init_1()
|
||||||
module.exports.bds_cpu = Math.trunc(list[pid].pcpu)
|
init_2()
|
||||||
} else {
|
}, 3000);
|
||||||
pid++
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}, 3000);
|
|
||||||
}else {
|
|
||||||
console.warn(`the use of cpu is disabled, for more information, visit https://docs.srherobrine23.com/enable_bds_requests.html`)
|
|
||||||
}
|
|
||||||
|
@ -11,6 +11,8 @@ Commands:
|
|||||||
/log
|
/log
|
||||||
/command
|
/command
|
||||||
/list
|
/list
|
||||||
|
/mcpe
|
||||||
|
/status
|
||||||
The messages are re-transmitted to the minecraft chat if it is already connected: ✔
|
The messages are re-transmitted to the minecraft chat if it is already connected: ✔
|
||||||
Message Control: ❌`
|
Message Control: ❌`
|
||||||
ctx.reply(amenssagem)
|
ctx.reply(amenssagem)
|
||||||
@ -82,44 +84,17 @@ 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://storage.googleapis.com/bds_mcpe_files/0.16.201.01.apk)
|
|
||||||
|
|
||||||
Iphone users are not privileged
|
Iphone users are not privileged
|
||||||
`
|
`)});
|
||||||
ctx.replyWithMarkdown(text)
|
bot.command("status", (ctx) =>{
|
||||||
|
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("status", (ctx) =>{
|
|
||||||
// const si = require("systeminformation");
|
|
||||||
// // si.cpu().then(data => {module.exports.cpu_speed = Math.trunc(data.speed)})
|
|
||||||
// si.mem().then(data => {
|
|
||||||
// global.ram_free = Math.trunc(data.free / 1024 / 1024 / 1024);
|
|
||||||
// global.ram_total = Math.trunc(data.total / 1024 / 1024 / 1024);
|
|
||||||
// si.currentLoad().then(data => {
|
|
||||||
// global.current_cpu = Math.trunc(data.currentload)
|
|
||||||
// si.processes().then(data => {
|
|
||||||
// const list = data.list
|
|
||||||
// for (let pid in list) {
|
|
||||||
// var pids = list[pid].command
|
|
||||||
// if (pids.includes("bedrock_server")){global.bds_cpu = Math.trunc(list[pid].pcpu)} else if (pids.includes("server.jar")){global.bds_cpu = Math.trunc(list[pid].pcpu)} else {pid++}
|
|
||||||
// }
|
|
||||||
// si.processes().then(data => {
|
|
||||||
// const list = data.list
|
|
||||||
// for (let pid in list) {
|
|
||||||
// var pids = list[pid].command
|
|
||||||
// if (pids.includes("bedrock_server")){global.bds_cpu = Math.trunc(list[pid].pcpu)} else {pid++}
|
|
||||||
// }
|
|
||||||
// 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`
|
|
||||||
// ctx.replyWithMarkdown(text);
|
|
||||||
// delete(bds_cpu);
|
|
||||||
// delete(current_cpu);
|
|
||||||
// delete(ram_total);
|
|
||||||
// delete(ram_free);
|
|
||||||
// })
|
|
||||||
// })
|
|
||||||
// })
|
|
||||||
// })
|
|
||||||
// });
|
|
||||||
bot.command("log", (ctx) => {
|
bot.command("log", (ctx) => {
|
||||||
const file_log_path = require("../index").log_file;
|
const file_log_path = require("../index").log_file;
|
||||||
const fs = require("fs")
|
const fs = require("fs")
|
||||||
|
28
package-lock.json
generated
28
package-lock.json
generated
@ -1,11 +1,11 @@
|
|||||||
{
|
{
|
||||||
"name": "bds_maneger_api",
|
"name": "bds_maneger_api",
|
||||||
"version": "1.5.0",
|
"version": "1.5.2",
|
||||||
"lockfileVersion": 2,
|
"lockfileVersion": 2,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"version": "1.5.0",
|
"version": "1.5.2",
|
||||||
"license": "AGPL-3.0-or-later",
|
"license": "AGPL-3.0-or-later",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"adm-zip": "^0.5.1",
|
"adm-zip": "^0.5.1",
|
||||||
@ -970,9 +970,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/open": {
|
"node_modules/open": {
|
||||||
"version": "7.3.1",
|
"version": "7.4.0",
|
||||||
"resolved": "https://registry.npmjs.org/open/-/open-7.3.1.tgz",
|
"resolved": "https://registry.npmjs.org/open/-/open-7.4.0.tgz",
|
||||||
"integrity": "sha512-f2wt9DCBKKjlFbjzGb8MOAW8LH8F0mrs1zc7KTjAJ9PZNQbfenzWbNP1VZJvw6ICMG9r14Ah6yfwPn7T7i646A==",
|
"integrity": "sha512-PGoBCX/lclIWlpS/R2PQuIR4NJoXh6X5AwVzE7WXnWRGvHg7+4TBCgsujUgiPpm0K1y4qvQeWnCWVTpTKZBtvA==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"is-docker": "^2.0.0",
|
"is-docker": "^2.0.0",
|
||||||
"is-wsl": "^2.1.1"
|
"is-wsl": "^2.1.1"
|
||||||
@ -1304,9 +1304,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/systeminformation": {
|
"node_modules/systeminformation": {
|
||||||
"version": "5.0.6",
|
"version": "5.0.8",
|
||||||
"resolved": "https://registry.npmjs.org/systeminformation/-/systeminformation-5.0.6.tgz",
|
"resolved": "https://registry.npmjs.org/systeminformation/-/systeminformation-5.0.8.tgz",
|
||||||
"integrity": "sha512-sX8I5SPunheS99VYBk1UGzavNMBGTizccaKcYo6TrjPaHF98iFeirexNX99zyGujlNWTVCHiVxzoNdix77hkVw==",
|
"integrity": "sha512-K2AzDnKx0ujD11EenI3VPegNM6ygGlcxj52SsaJ6B8JdYBgUS6HX8WrOY7dfqGvSkwqXNA/YkcWcf5EeFN5wng==",
|
||||||
"os": [
|
"os": [
|
||||||
"darwin",
|
"darwin",
|
||||||
"linux",
|
"linux",
|
||||||
@ -2248,9 +2248,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"open": {
|
"open": {
|
||||||
"version": "7.3.1",
|
"version": "7.4.0",
|
||||||
"resolved": "https://registry.npmjs.org/open/-/open-7.3.1.tgz",
|
"resolved": "https://registry.npmjs.org/open/-/open-7.4.0.tgz",
|
||||||
"integrity": "sha512-f2wt9DCBKKjlFbjzGb8MOAW8LH8F0mrs1zc7KTjAJ9PZNQbfenzWbNP1VZJvw6ICMG9r14Ah6yfwPn7T7i646A==",
|
"integrity": "sha512-PGoBCX/lclIWlpS/R2PQuIR4NJoXh6X5AwVzE7WXnWRGvHg7+4TBCgsujUgiPpm0K1y4qvQeWnCWVTpTKZBtvA==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"is-docker": "^2.0.0",
|
"is-docker": "^2.0.0",
|
||||||
"is-wsl": "^2.1.1"
|
"is-wsl": "^2.1.1"
|
||||||
@ -2500,9 +2500,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"systeminformation": {
|
"systeminformation": {
|
||||||
"version": "5.0.6",
|
"version": "5.0.8",
|
||||||
"resolved": "https://registry.npmjs.org/systeminformation/-/systeminformation-5.0.6.tgz",
|
"resolved": "https://registry.npmjs.org/systeminformation/-/systeminformation-5.0.8.tgz",
|
||||||
"integrity": "sha512-sX8I5SPunheS99VYBk1UGzavNMBGTizccaKcYo6TrjPaHF98iFeirexNX99zyGujlNWTVCHiVxzoNdix77hkVw=="
|
"integrity": "sha512-K2AzDnKx0ujD11EenI3VPegNM6ygGlcxj52SsaJ6B8JdYBgUS6HX8WrOY7dfqGvSkwqXNA/YkcWcf5EeFN5wng=="
|
||||||
},
|
},
|
||||||
"telegraf": {
|
"telegraf": {
|
||||||
"version": "4.0.2",
|
"version": "4.0.2",
|
||||||
|
@ -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