const fs = require('fs'); const path = require('path'); module.exports = (client) => { const commandsPath = path.join(__dirname, '../commands'); const commandFiles = fs.readdirSync(commandsPath).filter(file => file.endsWith('.js')); for (const file of commandFiles) { const filePath = path.join(commandsPath, file); // Clear require cache to allow updates during development delete require.cache[require.resolve(filePath)]; const command = require(filePath); if (command.name) { client.commands.set(command.name, command); } } };