Esempio n. 1
0
        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);
        }
Esempio n. 2
0
        internal bool TryAddMember(Snowflake id, CachedMember member, bool sync = false)
        {
            var result = _members.TryAdd(id, member);

            if (result && !sync)
            {
                MemberCount++;
            }
            return(result);
        }
Esempio n. 3
0
        internal bool TryRemoveMember(Snowflake id, out CachedMember member)
        {
            var result = _members.TryRemove(id, out member);

            if (result)
            {
                MemberCount--;
                member.SharedUser.References--;
            }
            return(result);
        }