// eslint-disable-next-line no-unused-vars const { Collection, Client } = require('discord.js'); // eslint-disable-next-line no-unused-vars const Command = require('./command'); const fs = require('fs'); const { path } = require('../../utils/fs'); /** Manages the loading of commands */ module.exports = class CommandManager { /** * Create a CommandManager instance * @param {Client} client */ constructor(client) { /** The Discord Client */ this.client = client; /** A discord.js Collection (Map) of loaded commands */ this.commands = new Collection(); } /** Automatically load all internal commands */ load() { const files = fs.readdirSync(path('./src/commands')) .filter(file => file.endsWith('.js')); for (const file of files) { const cmd = require(`../commands/${file}`); this.commands.set(cmd, new cmd(this.client)); } } };