Advertisement
firyphoenix

handleCommands.js

Apr 12th, 2023
22
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. const fs = require('fs')
  2.  
  3. module.exports = (client) => {
  4. client.handleCommands = async() => {
  5. const commandFolders = fs.readdirSync('./commands');
  6. for (const folder of commandFolders) {
  7. const commandFiles = fs.readdirSync('/commands/${folder}').filter(file => file.endswith('.js'));
  8.  
  9. const { commands, commandArray} = client;
  10. for (const file of commandFiles) {
  11. const command = require('../../commands/${folder}/${file}');
  12. commands.set(command.data.name, command);
  13. commandArray.push(command.data.toJSON());
  14. }
  15. }
  16. };
  17. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement