Files
valorantDiscordBot/lib/getCommands.js
2022-08-26 18:19:28 +00:00

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;
};