Fixed channel's user cache not populating on READY

This commit is contained in:
RogueException
2016-02-16 16:38:20 -04:00
parent 8e519d1925
commit c6af9fa70d

View File

@@ -161,7 +161,9 @@ namespace Discord
} }
internal void Update(ExtendedGuild model) internal void Update(ExtendedGuild model)
{ {
Update(model as Guild); //Needs channels Update(model as Guild);
//Only channels or members should have AddXXX(cachePerms: true), not both
if (model.Channels != null) if (model.Channels != null)
{ {
_channels = new ConcurrentDictionary<ulong, Channel>(2, (int)(model.Channels.Length * 1.05)); _channels = new ConcurrentDictionary<ulong, Channel>(2, (int)(model.Channels.Length * 1.05));
@@ -173,7 +175,7 @@ namespace Discord
{ {
_users = new ConcurrentDictionary<ulong, Member>(2, (int)(model.Members.Length * 1.05)); _users = new ConcurrentDictionary<ulong, Member>(2, (int)(model.Members.Length * 1.05));
foreach (var subModel in model.Members) foreach (var subModel in model.Members)
AddUser(subModel.User.Id, false).Update(subModel); AddUser(subModel.User.Id, true).Update(subModel);
} }
if (model.VoiceStates != null) if (model.VoiceStates != null)