title: "TypeError: Client.Collection is not a Constructor" error with Discord.js
body: <p>This is my first time using Discord.js as I'm trying to create a personal music bot for my friend's server. First, I'm going through a tutorial by CodeLyon but I've encountered an error and I'm not sure how to fix it since the video was released before the Gateway Intentions were added to Discord.js</p>
  <p>The error I'm currently getting states:</p>
  <blockquote>
  <p>TypeError: Client.Collection is not a constructor
  at Object.&lt; anonymous&gt; (C:\Users\Jewel Wildmoon\Downloads\My Discord Bots\Music Bots\Bot\main.js:9:19)
  at Module._compile (node:internal/modules/cjs/loader:1101:14)
  at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
  at Module.load (node:internal/modules/cjs/loader:981:32)
  at Function.Module._load (node:internal/modules/cjs/loader:822:12)
  at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:79:12)
  at node:internal/main/run_main_module:17:47</p>
  </blockquote>
  <p>This is my code so far in my main.js file:</p>
  <pre><code>const { Client, Intents } = require('discord.js');
  
  const client = new Client({ intents: [Intents.FLAGS.GUILDS, Intents.FLAGS.GUILD_MESSAGES] });
  
  const prefix = '!';
  
  const fs = require('fs');
  
  client.commands = new Client.Collection();
  
  const commandFiles = fs.readdirSync('./commands/').filter(file =&gt; file.endsWith('.js'));
  for(const file of commandFiles){
      const command = require('./commands/${file}');
  
  
      client.commands.set(command.name, command);
  }
  
  client.once('ready', () =&gt; {
      console.log('Bot is Online!');
  });
  
  client.on('message', message =&gt; {
      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);
      } else if(command == 'youtube'){
          message.channel.send('LINK');
      }
  });
  
  
  client.login('TOKEN');
  </code></pre>
  <p>And this is my current code in the ping.js file:</p>
  <pre><code>module.exports = {
      name: 'ping',
      description: &quot;This is a ping command&quot;,
      execute(message, args){
          message.channel.send('pong!');
      }
  }
  </code></pre>
  <p>Not quite sure what to do here as again, I haven't use Discord.js and am not familiar with Gateway Intentions. That and I'm still new to JavaScript.</p>