internal void HandleGuildCreate(GatewayGuild data) { if (!_guilds.TryGetValue(data.Id.RawValue, out var guild)) { guild = new CachedGuild { Id = data.Id }; guild.Update(data); _guilds[data.Id.RawValue] = guild; Created?.Invoke(guild); guild.Unavailable = data.Unavailable; if (guild.Unavailable != true) { Available?.Invoke(guild); } } else { if (data.Unavailable == false && guild.Unavailable != false) { guild.Unavailable = false; Available?.Invoke(guild); } else if (data.Unavailable == true && guild.Unavailable != true) { guild.Unavailable = true; Unavailable?.Invoke(guild); } guild.Update(data); } }
internal void Update(GatewayGuild data) { // Unavailable = data.Unavailable; // This is handled manually in GuildCache Update(data as Guild); }