title: When checking invites is the following
body: <p>If I create a new express invitation to the server when the bot is turned on, an error occurs. In other cases, it works</p>
  
  <pre class="lang-js prettyprint-override"><code>const invites = {};
  const wait = require('util').promisify(setTimeout);
  client.on('ready', () =&gt; {
    wait(1000);
      g.fetchInvites().then(guildInvites =&gt; {
        invites[g.id] = guildInvites;
      });
    });
  });
  client.on('guildMemberAdd', member =&gt; {
     member.guild.fetchInvites().then(guildInvites =&gt; {
       const ei = invites[member.guild.id];
       invites[member.guild.id] = guildInvites;
       const invite = guildInvites.find(i =&gt; ei.get(i.code).uses &lt; i.uses);
       const inviter = client.users.get(invite.inviter.id);
       const logChannel = member.guild.channels.find(channel =&gt; channel.name === "join-logs");
       logChannel.send(`${member.user.tag} joined using invite code ${invite.code} from ${inviter.tag}. Invite was used ${invite.uses} times since its creation.`);
     });
   });
  </code></pre>
  
  <p>Errors:</p>
  
  <pre class="lang-js prettyprint-override"><code>2019-07-07T09:49:20.363359+00:00 app[worker.1]: Unhandled Rejection: 
  2019-07-07T09:49:20.363377+00:00 app[worker.1]:  TypeError: Cannot read property 'uses' of undefined
  2019-07-07T09:49:20.363378+00:00 app[worker.1]:     at guildInvites.find.i (./bot.js:398:57)
  2019-07-07T09:49:20.363380+00:00 app[worker.1]:     at Map.find (./node_modules/discord.js/src/util/Collection.js:160:13)
  2019-07-07T09:49:20.363381+00:00 app[worker.1]:     at member.guild.fetchInvites.then.guildInvites (./bot.js:398:33)
  2019-07-07T09:49:20.363382+00:00 app[worker.1]:     at process._tickCallback (internal/process/next_tick.js:68:7)
  </code></pre>
  
  <p>398 deadline</p>
  
  <pre class="lang-js prettyprint-override"><code>const invite = guildInvites.find(i =&gt; ei.get(i.code).uses &lt; i.uses);
  </code></pre>