Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

133
Views
TypeError: "x" is not a function

So when I was coding a Discord bot, it suddenly just started saying stuff wasn't a function. And this applies to everything, it really just applies to anything and if I try to call a function then it says it's not a function. For example:

For example this line of code I have here:

client.commandHandler(commandFolders, "./src/commands")

It says it's not a function, but I've defined it as a function:

module.exports = (client) => {
    client.commandHandler = async (commandFolders, path) => {
        const cmds = [];
        for (const folder of commandFolders) {
            const commandFiles = fs.readdirSync(`${path}/${folder}`).filter(f => f.endsWith('.js'));
            for (const f of commandFiles) {
                const command = require(`${path}/${folder}/${f}`)
                cmds.push(command.data.toJSON());
            }
        }
}
}

Anyone know why?

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!