buddy

node MVC discord bot
Log | Files | Refs | README

READY.js (502B)


      1 'use strict';
      2 
      3 let ClientUser;
      4 
      5 module.exports = (client, { d: data }, shard) => {
      6   if (client.user) {
      7     client.user._patch(data.user);
      8   } else {
      9     if (!ClientUser) ClientUser = require('../../../structures/ClientUser');
     10     const clientUser = new ClientUser(client, data.user);
     11     client.user = clientUser;
     12     client.users.cache.set(clientUser.id, clientUser);
     13   }
     14 
     15   for (const guild of data.guilds) {
     16     guild.shardID = shard.id;
     17     client.guilds.add(guild);
     18   }
     19 
     20   shard.checkReady();
     21 };