Don't hardcode the folders
This commit is contained in:
parent
2714c748bf
commit
424d5ab02a
2 changed files with 9 additions and 12 deletions
11
index.js
11
index.js
|
@ -17,12 +17,11 @@ const client = new Client({
|
|||
|
||||
// Load commands
|
||||
client.commands = new Collection();
|
||||
await loadCommandFromDir('fun');
|
||||
await loadCommandFromDir('secret');
|
||||
await loadCommandFromDir('utility');
|
||||
await loadCommandFromDir('voice');
|
||||
await loadCommandFromDir('admin');
|
||||
await loadCommandFromDir('owner');
|
||||
|
||||
const categoryPath = fs.readdirSync(`${__dirname}/commands`);
|
||||
categoryPath.forEach(category => {
|
||||
loadCommandFromDir(category);
|
||||
});
|
||||
|
||||
// Load events
|
||||
await loadEventFromDir('client', client);
|
||||
|
|
|
@ -11,12 +11,10 @@ const __filename = fileURLToPath(import.meta.url);
|
|||
const __dirname = path.dirname(__filename);
|
||||
|
||||
const commands = [];
|
||||
await loadCommandFromDir('fun');
|
||||
await loadCommandFromDir('secret');
|
||||
await loadCommandFromDir('utility');
|
||||
await loadCommandFromDir('voice');
|
||||
await loadCommandFromDir('admin');
|
||||
await loadCommandFromDir('owner');
|
||||
const categoryPath = fs.readdirSync(`${__dirname}/../commands`);
|
||||
categoryPath.forEach(category => {
|
||||
loadCommandFromDir(category);
|
||||
});
|
||||
commands.map(command => command.toJSON());
|
||||
|
||||
const rest = new REST({ version: '9' }).setToken(token);
|
||||
|
|
Loading…
Reference in a new issue