Add boilerplate
This commit is contained in:
25
lib/getCommands.js
Normal file
25
lib/getCommands.js
Normal file
@@ -0,0 +1,25 @@
|
||||
'use strict';
|
||||
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
|
||||
const { Collection } = require('discord.js');
|
||||
|
||||
module.exports = () => {
|
||||
const commands = new Collection();
|
||||
|
||||
fs.readdirSync(path.join(__dirname, '..', 'commands'))
|
||||
.filter(file => file.endsWith('.js'))
|
||||
.forEach(file => {
|
||||
const command = require(path.join(
|
||||
__dirname,
|
||||
'..',
|
||||
'commands',
|
||||
file
|
||||
));
|
||||
|
||||
commands.set(command.data.name, command);
|
||||
});
|
||||
|
||||
return commands;
|
||||
};
|
||||
Reference in New Issue
Block a user