const Action = require('./Action');

class GuildSync extends Action {
  handle(data) {
    const client = this.client;

    const guild = client.guilds.get(data.id);
    if (guild) {
      data.presences = data.presences || [];
      for (const presence of data.presences) {
        guild._setPresence(presence.user.id, presence);
      }

      data.members = data.members || [];
      for (const syncMember of data.members) {
        const member = guild.members.get(syncMember.user.id);
        if (member) {
          guild._updateMember(member, syncMember);
        } else {
          guild._addMember(syncMember, false);
        }
      }
    }
  }
}

module.exports = GuildSync;

@@ -186,25 +186,12 @@
     
-data.presences = 
+if (
 data
@@ -200,24 +200,22 @@
 resences
- %7C%7C %5B%5D;%0A
+) %7B%0A  
       fo
@@ -250,26 +250,16 @@
 esences)
- %7B%0A       
  guild._
@@ -314,16 +314,20 @@
 %0A%0A      
+if (
 data.mem
@@ -334,31 +334,14 @@
 bers
- = data.members %7C%7C %5B%5D;%0A
+) %7B%0A  
     
@@ -375,32 +375,34 @@
 data.members) %7B%0A
+  
         const me
@@ -451,24 +451,26 @@
 d);%0A        
+  
 if (member) 
@@ -477,24 +477,26 @@
 %7B%0A          
+ 
+ 
 guild._updat
@@ -532,16 +532,18 @@
         
+  
 %7D else %7B
@@ -543,16 +543,18 @@
  else %7B%0A
+  
         
@@ -604,18 +604,22 @@
     
-%7D%0A
+  %7D%0A  
       %7D%0A
     
@@ -610,24 +610,86 @@
 %7D%0A        %7D%0A
+      %7D%0A%0A      if ('large' in data) guild.large = data.large;%0A
     %7D%0A  %7D%0A%7D%0A

Fix Guild#large not being accurate for user accounts