mirror of
https://github.com/Expand-sys/mcbot
synced 2025-12-16 23:12:12 +11:00
added some logging and conditions
This commit is contained in:
parent
9b53f0486f
commit
40580ecc47
1 changed files with 5 additions and 2 deletions
|
|
@ -9,7 +9,7 @@ const dig = require("gamedig")
|
|||
const path = require('path');
|
||||
const { channelSend } = require('../../utils/utils');
|
||||
serverofflinefor = 0;
|
||||
|
||||
let restarted = 0;
|
||||
module.exports = {
|
||||
name: 'ready',
|
||||
once: true,
|
||||
|
|
@ -32,12 +32,15 @@ module.exports = {
|
|||
//console.log(state);
|
||||
//console.log(state.players)
|
||||
serverofflinefor = 0;
|
||||
restarted = 0;
|
||||
}).catch((error) => {
|
||||
console.log("Server is offline" + error);
|
||||
serverofflinefor += 10
|
||||
channelSend(`Server offline for ~${serverofflinefor}`)
|
||||
if(serverofflinefor > 60){
|
||||
if(serverofflinefor > 60 && restarted != 1){
|
||||
channelSend(`server Offline for 60 seconds Restarting`)
|
||||
const mc = spawn("screen", ['-dmS', 'minecraft', '/bin/bash', `${process.env.SERSTARTLOC}`])
|
||||
restarted = 1
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue