From 3c0d5b01b5c50e30825098075c4c293ef86a8e29 Mon Sep 17 00:00:00 2001 From: Junior Date: Fri, 22 Nov 2024 20:27:35 +0000 Subject: [PATCH] Add config option to assume (not check) host online status --- config/config-dist.js | 3 ++- includes/class_server.js | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/config/config-dist.js b/config/config-dist.js index f2a4725..3b17f4b 100644 --- a/config/config-dist.js +++ b/config/config-dist.js @@ -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; diff --git a/includes/class_server.js b/includes/class_server.js index ecac5d6..4143e2f 100644 --- a/includes/class_server.js +++ b/includes/class_server.js @@ -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;