Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

200
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda