15 lines
453 B
JavaScript
15 lines
453 B
JavaScript
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);
|
|
const command = require(filePath);
|
|
if (command.name) {
|
|
client.commands.set(command.name, command);
|
|
}
|
|
}
|
|
}; |