mirror of
https://github.com/Expand-sys/mc-server-monitor
synced 2025-12-16 17:12:14 +11:00
maybe this is working
This commit is contained in:
parent
cc8cbf506f
commit
33a5815b35
3 changed files with 6 additions and 3 deletions
BIN
bun.lockb
BIN
bun.lockb
Binary file not shown.
9
index.ts
9
index.ts
|
|
@ -6,10 +6,12 @@ let serverstatus = 0
|
||||||
runevery15seconds(1)
|
runevery15seconds(1)
|
||||||
function runevery15seconds(i) {
|
function runevery15seconds(i) {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
|
|
||||||
Gamedig.query({
|
Gamedig.query({
|
||||||
type: 'minecraft',
|
type: 'minecraft',
|
||||||
host: 'mc.emre-personal.net'
|
host: 'mc.emre-personal.net',
|
||||||
|
port: 25565,
|
||||||
|
debug: true,
|
||||||
|
socketTimeout: 3000
|
||||||
}).then((state) => {
|
}).then((state) => {
|
||||||
console.log(state);
|
console.log(state);
|
||||||
if(serverstatus == 0){
|
if(serverstatus == 0){
|
||||||
|
|
@ -31,6 +33,7 @@ function runevery15seconds(i) {
|
||||||
|
|
||||||
}).catch((error: any) => {
|
}).catch((error: any) => {
|
||||||
console.log("Server is offline");
|
console.log("Server is offline");
|
||||||
|
console.log(error)
|
||||||
if( serverstatus == 1){
|
if( serverstatus == 1){
|
||||||
var params = {
|
var params = {
|
||||||
username: "MC-monitor",
|
username: "MC-monitor",
|
||||||
|
|
@ -51,6 +54,6 @@ function runevery15seconds(i) {
|
||||||
|
|
||||||
});
|
});
|
||||||
runevery15seconds(++i);
|
runevery15seconds(++i);
|
||||||
}, 15000)
|
}, 5000)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
BIN
mc-monitor
BIN
mc-monitor
Binary file not shown.
Loading…
Reference in a new issue