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

136
Views
Collection is not a fuction Discord.js

I tried to get my bot to fetch other Javascript files but it says that Collection is not a function

client.command = Client.Collection();

const commandFiles = fs.readdirSync('./commands/').filter(file => file.endsWith('.js'));
for(const file of commandFiles){
    const command = require(`./commands/${file}`);
    client.commands.set(command.name, command);
}
    } else if (command === 'ping'){
        client.command.get('ping').execute(message,args);
    }

The code is bigger but I removed it so it doesn't take up so much space.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Collection is a class which should be invoked once required from the library

const { Collection } = require('discord.js');

client.commands = new Collection();
about 4 years ago · Juan Pablo Isaza Report
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!