title: Discord.js - ReferenceError: join is not defined
body: <p>I was trying to organize my commands to categories but I get an error when running my bot:</p>
  <pre class="lang-js prettyprint-override"><code>const getDirectories = source =&gt; fs.readdirSync(source).map(name =&gt; join(source, name)).filter(isDirectory);
                                                                      ^
  ReferenceError: join is not defined
  </code></pre>
  <p><a href="https://i.stack.imgur.com/80cQw.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/80cQw.png" alt="enter image description here" /></a></p>
  <p>I have commands stored as categories like shown in the image above and the code for the main file is:</p>
  <pre class="lang-js prettyprint-override"><code>const fs = require(&quot;fs&quot;);
  const { token, prefix } = require('./config.json');
  const Discord = require('discord.js');
  const db = require ('quick.db');
  
  const client = new Discord.Client
  client.commands = new Discord.Collection();
  // First get the category directories
  const isDirectory = source =&gt; fs.lstatSync(source).isDirectory();
  const getDirectories = source =&gt; fs.readdirSync(source).map(name =&gt; join(source, name)).filter(isDirectory);
  
  // Then load the commands
  getDirectories(__dirname + '/commands').forEach(category =&gt; {
    const commandFiles = fs.readdirSync(category).filter(file =&gt; file.endsWith('.js'));
  
    for(const file of commandFiles) {
      const command = require(`./${category}/${file}`);
      client.commands.set(command.name, command);
    }
  });
  
  client.on(&quot;ready&quot;, () =&gt; {
      console.log(`ready!.`);
      console.log(token);
      
      // Activities  
      const activities_list = [ 
          `Serving Tacos | .help`,
          `Preparing Orders | .help`
      ];
      
      setInterval(() =&gt; {
          const index = Math.floor(Math.random() * (activities_list.length - 1) + 1);
          client.user.setActivity(activities_list[index]);
      }, 10000);
  });
  // rest of the code
  </code></pre>