While working on my Discord bot using Discord.js and following Codelyon's code, I encountered an error that has me stuck:
ReferenceError: DiscordCollection is not defined at Object.<anonymous>
const {Client, Intents, DiscordAPIError, Collection} = require('discord.js');
const client = new Discord.Client({ intents: ["GUILDS", "GUILD_MESSAGES"] });
const prefix = '-';
const fs = require('fs');
client.commands = new DiscordCollection();
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);
}
client.once('ready', () => {
console.log('Ceeby Is Online');
})
client.on('message', message => {
if(!message.content.startsWith(prefix) || message.author.bot) return;
const args = message.content.slice(prefix.length).split(/ +/);
const command = args.shift().toLowerCase();
if(command === 'ping'){
client.commands.get('ping').execute(message, args);
}
})
client.login('TOKEN')