Add config option to assume (not check) host online status

This commit is contained in:
Junior 2024-11-22 20:27:35 +00:00
parent 71138985be
commit 3c0d5b01b5
2 changed files with 4 additions and 1 deletions

View File

@ -6,7 +6,8 @@ const config = {
STAFF_ROLE: '123456789012345678',
RESTART_ROLE: '123456789012345678',
ALLOW_RESTART: false,
PRESENCE_INTERVAL: 5
PRESENCE_INTERVAL: 5,
ONLINE_CHECK: false
}
module.exports = config;

View File

@ -1,5 +1,6 @@
const ChildProcess = require('child_process');
const { Client, GatewayIntentBits, Partials, EmbedBuilder } = require('discord.js');
const Config = require('./config/config');
class Server {
@ -39,6 +40,7 @@ class Server {
hostIsAlive() {
if ( !this.active || (this.rconAddress == "") ) return false;
if ( Config.ONLINE_CHECK == false ) return true;
try {
let res = ChildProcess.execSync('ping -c 1 -W 0.25 -q ' + this.rconAddress);
return true;