26 lines
467 B
JavaScript
26 lines
467 B
JavaScript
'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;
|
|
};
|