Build the Server.EveryoneRole object early just in case

This commit is contained in:
RogueException
2015-12-11 21:42:07 -04:00
parent 4bf4df5c51
commit 4e9a2833e1

View File

@@ -102,7 +102,8 @@ namespace Discord
_members = new ConcurrentDictionary<long, ServerMember>(); _members = new ConcurrentDictionary<long, ServerMember>();
//Local Cache //Local Cache
_bans = new ConcurrentDictionary<long, bool>(); _bans = new ConcurrentDictionary<long, bool>();
EveryoneRole = _client.Roles.GetOrAdd(id, id);
} }
internal override bool LoadReferences() internal override bool LoadReferences()
{ {
@@ -254,11 +255,7 @@ namespace Discord
} }
internal void RemoveRole(Role role) internal void RemoveRole(Role role)
{ {
if (_roles.TryRemove(role.Id, out role)) _roles.TryRemove(role.Id, out role);
{
if (role.Id == Id)
EveryoneRole = null;
}
} }
internal ServerPermissions GetPermissions(User user) internal ServerPermissions GetPermissions(User user)