This commit is contained in:
yhqe committed 2026-03-15 03:45:16 -05:00
1 parent a27bfb63e8
commit 670512944c
15 files changed
+33568 -43

No files matched your search

+17 -3
View File
@@ -12,9 +12,23 @@ const logger = require('../utils/logger');
*/
function loadCommands(client) {
const commandsPath = path.join(__dirname, '..', 'commands');
const commandFiles = fs
.readdirSync(commandsPath)
.filter((file) => file.endsWith('.js'));
// Recursively get all .js files in commandsPath
function getAllCommandFiles(dir) {
let results = [];
const list = fs.readdirSync(dir, { withFileTypes: true });
for (const entry of list) {
const fullPath = path.join(dir, entry.name);
if (entry.isDirectory()) {
results = results.concat(getAllCommandFiles(fullPath));
} else if (entry.isFile() && entry.name.endsWith('.js')) {
results.push(path.relative(commandsPath, fullPath));
}
}
return results;
}
const commandFiles = getAllCommandFiles(commandsPath);
let loaded = 0;