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

204
Views
When creating an advanced commands handler on discord.js, should the first line be ```cleient.commands - new Discord.Collections();

so I'm working on branching off from basic commands to creating an advanced command handler and I'm following some youtube videos and guides, but I seem to be stuck. I'm getting an error that says Discord.Collections is not a constructor and I've looked everywhere and can't seem to find the answer to my problem so I thought I'd ask you guys for some help.

const { Client, Intents } = require('discord.js');
const { MessageEmbed } = require('discord.js')

const client = new Client({ intents: [Intents.FLAGS.GUILDS, Intents.FLAGS.GUILD_MESSAGES] });

const prefix = '-';

const fs = require('fs');
const Discord = require('discord.js');


//Try to debug later
client.commands = new Discord.Collections();

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);
}

That's the code I have so far for it and in most forum it seems like it checks out, but I'm following an old video so maybe discord.js updated it to a new syntax or phrase along those lines? All help would be appreciated!

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

0

It's Collection without the 's'. Also you should clean up your imports since you seem to be importing the same module three times.

const { Client, Intents, MessageEmbed, 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!