Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const fs = require('fs')
- module.exports = (client) => {
- client.handleCommands = async() => {
- const commandFolders = fs.readdirSync('./commands');
- for (const folder of commandFolders) {
- const commandFiles = fs.readdirSync('/commands/${folder}').filter(file => file.endswith('.js'));
- const { commands, commandArray} = client;
- for (const file of commandFiles) {
- const command = require('../../commands/${folder}/${file}');
- commands.set(command.data.name, command);
- commandArray.push(command.data.toJSON());
- }
- }
- };
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement