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,8 +1,6 @@
|
|||||||
const bds_monitor = process.env.BDS_MONI.includes("true")
|
const si = require("systeminformation");
|
||||||
if (bds_monitor){
|
|
||||||
const si = require("systeminformation");
|
|
||||||
setInterval(() => {
|
setInterval(() => {
|
||||||
// si.cpu().then(data => {module.exports.cpu_speed = Math.trunc(data.speed)})
|
si.cpu().then(data => {module.exports.cpu_speed = Math.trunc(data.speed)})
|
||||||
si.mem().then(data => {
|
si.mem().then(data => {
|
||||||
module.exports.ram_free = Math.trunc(data.free / 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);
|
module.exports.ram_total = Math.trunc(data.total / 1024 / 1024 / 1024);
|
||||||
@ -16,7 +14,7 @@ if (bds_monitor){
|
|||||||
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].pcpu)
|
||||||
} else {
|
} else {
|
||||||
pid++
|
pid++
|
||||||
@ -28,7 +26,7 @@ if (bds_monitor){
|
|||||||
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].pcpu)
|
||||||
} else {
|
} else {
|
||||||
pid++
|
pid++
|
||||||
@ -36,6 +34,3 @@ if (bds_monitor){
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
}, 3000);
|
}, 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)
|
||||||
@ -83,43 +85,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.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://storage.googleapis.com/bds_mcpe_files/0.16.201.01.apk)
|
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)
|
ctx.replyWithMarkdown(text)
|
||||||
});
|
});
|
||||||
// bot.command("status", (ctx) =>{
|
bot.command("status", (ctx) =>{
|
||||||
// const si = require("systeminformation");
|
const status = require("./system_monitor")
|
||||||
// // si.cpu().then(data => {module.exports.cpu_speed = Math.trunc(data.speed)})
|
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`
|
||||||
// si.mem().then(data => {
|
ctx.replyWithMarkdown(text);
|
||||||
// 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")
|
||||||
|
Reference in New Issue
Block a user