AlexzanderFlores / Worn-Off-Keys-Discord-Js

469 stars 514 forks source link

feature is not a function #9

Closed trende2001 closed 3 years ago

trende2001 commented 3 years ago

(node:6136) UnhandledPromiseRejectionWarning: TypeError: feature is not a function

the code is EXACTLY the same

const path = require('path')
const fs = require('fs')

module.exports = (client) => {
  const readFeatures = (dir) => {
    const files = fs.readdirSync(path.join(__dirname, dir))
    for (const file of files) {
      const stat = fs.lstatSync(path.join(__dirname, dir, file))
      if (stat.isDirectory()) {
        readFeatures(path.join(dir, file))
      } else if (file !== 'load-features.js') {
        const feature = require(path.join(__dirname, dir, file))
        console.log(`Enabling feature "${file}"`)
        feature(client)
      }
    }
  }

  readFeatures('.')
}