Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

201
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda