title: Discord.js: Cannot read property 'set' of undefined
body: <p>I'm creating bot with discord.js.
  This is my code:</p>
  
  <pre><code>var Discord = require('discord.js');
  const swarmConfig = require('./swarmConfig.json');
  
  var swarmbot = new Discord.Client();
  swarmbot.login('myToken');
  
  fs.readdir('./commands/', (err, files) =&gt;{
    if(err) console.log(err);
    var jsFiles = files.filter(f =&gt; f.split('.').pop() === 'js');
  
    if(jsFiles.length &lt;=0){
      console.log('Cant find commands');
      return;
    }
  
    jsFiles.forEach((f, i) =&gt;{
      let fileGet = require(`./commands/${f}`);
      console.log(`${f} loaded!`);
      swarmbot.commands.set(fileGet.help.name, fileGet);
    });
  });
  
  swarmbot.on("message", async message =&gt;{
    if (message.author.swarmbot) 
      return;
    var prefix = swarmConfig.prefix;
    var command = messageArray[0];
    var arguments = messageArray.slice(1);
  
    var commands = swarmbot.commands.get(command.slice(prefix.length));
    if(commands) 
      commands.run(swarmbot, message, arguments);
  });
  </code></pre>
  
  <p>But if I try to start it, I get this error:</p>
  
  <pre><code>C:\Users\purul\Desktop\swarm-dsbot\swarm.js:25
  swarmbot.commands.set(fileGet.help.name, fileGet);
                    ^
  TypeError: Cannot read property 'set' of undefined
  at jsFiles.forEach (C:\Users\purul\Desktop\swarm-dsbot\swarm.js:25:23)
  at Array.forEach (&lt;anonymous&gt;)
  at fs.readdir (C:\Users\purul\Desktop\swarm-dsbot\swarm.js:22:11)
  at FSReqWrap.oncomplete (fs.js:141:20)
  </code></pre>
  
  <p>I'm still learning JavaScript, Thanks to everyone who will help with this.</p>