Advertisement
gamodu62100

loadCommands.js

Mar 20th, 2023
787
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  const fs = require('fs')
  2.  
  3.  module.exports = async bot => {
  4.  
  5.     fs.readdirSync("./Commands").filter(f => f.endsWith(".js")).forEach(async file => {
  6.        
  7.         let command = require(`../commands/${file}`)
  8.         if(!command.name || typeof command.name !== "string") throw new TypeError(`La commende ${file.slice(0, file.length -3 )} n'est pas une commande valide`)
  9.        bot.commands.set(command.name, command)
  10.        console.log(`Commande ${file} chargée avec succès !`)
  11.    })
  12. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement