From c4703ca029f8d1c4c7a5ee1a398fa4d6c954030d Mon Sep 17 00:00:00 2001 From: dromero14521 Date: Wed, 29 Apr 2026 05:58:27 -0700 Subject: [PATCH] fix: add directory existence checks (Fixes #3) --- src/bot.js | 4 ++++ src/deploy-commands.js | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/src/bot.js b/src/bot.js index b68d19e..dc39002 100644 --- a/src/bot.js +++ b/src/bot.js @@ -35,6 +35,10 @@ loadCommands('prefixcommands', client.prefixCommands); const loadEvents = () => { const eventsPath = path.join(__dirname, 'events'); + if (!fs.existsSync(eventsPath)) { + console.warn(`[WARNING] Events directory missing at ${eventsPath}. Auto-creating it.`); + fs.mkdirSync(eventsPath, { recursive: true }); + } const eventFiles = fs.readdirSync(eventsPath).filter(f => f.endsWith('.js')); for (const file of eventFiles) { diff --git a/src/deploy-commands.js b/src/deploy-commands.js index 4b64309..55b5f1b 100644 --- a/src/deploy-commands.js +++ b/src/deploy-commands.js @@ -5,6 +5,10 @@ const path = require('path'); const commands = []; const commandsPath = path.join(__dirname, 'commands'); +if (!fs.existsSync(commandsPath)) { + console.warn(`[WARNING] Commands directory missing at ${commandsPath}. Auto-creating it.`); + fs.mkdirSync(commandsPath, { recursive: true }); +} const commandFiles = fs.readdirSync(commandsPath).filter(f => f.endsWith('.js')); for (const file of commandFiles) {