From 834b2ea188b9a2c23f46fd889f5b6a5110906ab5 Mon Sep 17 00:00:00 2001 From: koko210Serve Date: Thu, 9 Apr 2026 20:15:57 +0300 Subject: [PATCH] fix: start with zero servers when config is missing or corrupt MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Removed _create_default_config() which hardcoded a specific guild ID (759889672804630530) as a fallback. Now: - Missing servers_config.json → starts with empty servers dict - Corrupt JSON → logs error, starts with empty servers dict - Servers are added via the API/dashboard, not by magic defaults All code that iterates server_manager.servers handles empty dicts safely. --- bot/server_manager.py | 20 ++------------------ 1 file changed, 2 insertions(+), 18 deletions(-) diff --git a/bot/server_manager.py b/bot/server_manager.py index b96adf8..3125256 100644 --- a/bot/server_manager.py +++ b/bot/server_manager.py @@ -94,9 +94,9 @@ class ServerManager: self.repair_config() except Exception as e: logger.error(f"Failed to load server config: {e}") - self._create_default_config() + logger.info("Starting with zero servers — add servers via the API or dashboard") else: - self._create_default_config() + logger.info("No servers_config.json found — starting with zero servers") def repair_config(self): """Repair corrupted configuration data and save it back""" @@ -122,22 +122,6 @@ class ServerManager: except Exception as e: logger.error(f"Failed to repair config: {e}") - def _create_default_config(self): - """Create default configuration for backward compatibility""" - default_server = ServerConfig( - guild_id=759889672804630530, - guild_name="Default Server", - autonomous_channel_id=761014220707332107, - autonomous_channel_name="miku-chat", - bedtime_channel_ids=[761014220707332107], - enabled_features={"autonomous", "bedtime", "monday_video"}, - autonomous_interval_minutes=10, - conversation_detection_interval_minutes=3 - ) - self.servers[default_server.guild_id] = default_server - self.save_config() - logger.info("Created default server configuration") - def save_config(self): """Save server configurations to file""" try: