public CachedMember AddMember(CachedGuild guild, MemberModel memberModel, UserModel usermodel, bool sync = false) { var member = new CachedMember(GetOrAddSharedUser(usermodel), guild, memberModel); guild.TryAddMember(usermodel.Id, member, sync); return(member); }
internal bool TryAddMember(Snowflake id, CachedMember member, bool sync = false) { var result = _members.TryAdd(id, member); if (result && !sync) { MemberCount++; } return(result); }
internal bool TryRemoveMember(Snowflake id, out CachedMember member) { var result = _members.TryRemove(id, out member); if (result) { MemberCount--; member.SharedUser.References--; } return(result); }