title: I want to get members count in discord bot but it gives error
body: <p>I want to get members count in discord bot but it gives error. I search for it through internet for this and i don't find it!
  Here is code:</p>
  
  <pre><code>const Commando = require('discord.js-commando');
  const bot = new Commando.Client({commandPrefix: '$'});
  const TOKEN = 'here is token';
  const MIN_INTERVAL = 3 * 1000;
  const guild = bot.guilds.get("394805546450026496");
  
  bot.registry.registerGroup('connectc', 'Connectc');
  bot.registry.registerGroup('defaultc', 'Defaultc');
  bot.registry.registerDefaults();
  bot.registry.registerCommandsIn(__dirname + "/commands")
  
  bot.on('ready', function(){
      console.log("Ready");
      setInterval(function(){
          var memberCount = guild.members.filter(member =&gt; !member.user.bot).size;
          var memberCountChannel = bot.channels.get("547805078787194891");
          memberCountChannel.setName("Osoby: "+ memberCount +" ");
      }, MIN_INTERVAL);
  });
  bot.login(TOKEN);
  </code></pre>
  
  <p>And here error:</p>
  
  <pre><code>C:\Users\User\Documents\Visual Studio Code\Discord Bots\VblacqeBot\index.js:18
      var memberCount = guild.members.filter(member =&gt; !member.user.bot).size;
                              ^
  
  TypeError: Cannot read property 'members' of undefined
      at CommandoClient.&lt;anonymous&gt; (C:\Users\User\Documents\Visual Studio Code\Discord Bots\VblacqeBot\index.js:18:29)    
      at CommandoClient.emit (events.js:194:15)
      at WebSocketConnection.triggerReady (C:\Users\User\Documents\Visual Studio Code\Discord Bots\VblacqeBot\node_modules\discord.js\src\client\websocket\WebSocketConnection.js:125:17)
      at WebSocketConnection.checkIfReady (C:\Users\User\Documents\Visual Studio Code\Discord Bots\VblacqeBot\node_modules\discord.js\src\client\websocket\WebSocketConnection.js:141:61)
      at GuildCreateHandler.handle (C:\Users\User\Documents\Visual Studio Code\Discord Bots\VblacqeBot\node_modules\discord.js\src\client\websocket\packets\handlers\GuildCreate.js:13:31)
      at WebSocket.onMessage (C:\Users\User\Documents\Visual Studio Code\Discord Bots\VblacqeBot\node_modules\ws\lib\event-target.js:120:16)
      at WebSocket.emit (events.js:189:13)
  </code></pre>
  
  <p>Please help me!</p>