Example #1
0
        internal static SocketGuildUser Create(SocketGuild guild, ClientState state, MemberModel model)
        {
            var entity = new SocketGuildUser(guild, guild.Discord.GetOrCreateUser(state, model.User));

            entity.Update(state, model);
            return(entity);
        }
 internal void Update(ClientState state, MemberModel model)
 {
     base.Update(state, model.User);
     if (model.JoinedAt.IsSpecified)
     {
         _joinedAtTicks = model.JoinedAt.Value.UtcTicks;
     }
     if (model.Nick.IsSpecified)
     {
         Nickname = model.Nick.Value;
     }
     if (model.Avatar.IsSpecified)
     {
         GuildAvatarId = model.Avatar.Value;
     }
     if (model.Roles.IsSpecified)
     {
         UpdateRoles(model.Roles.Value);
     }
     if (model.PremiumSince.IsSpecified)
     {
         _premiumSinceTicks = model.PremiumSince.Value?.UtcTicks;
     }
     if (model.TimedOutUntil.IsSpecified)
     {
         _timedOutTicks = model.TimedOutUntil.Value?.UtcTicks;
     }
     if (model.Pending.IsSpecified)
     {
         IsPending = model.Pending.Value;
     }
 }
 internal void Update(Model model)
 {
     base.Update(model.User);
     if (model.JoinedAt.IsSpecified)
     {
         _joinedAtTicks = model.JoinedAt.Value.UtcTicks;
     }
     if (model.Nick.IsSpecified)
     {
         Nickname = model.Nick.Value;
     }
     if (model.Deaf.IsSpecified)
     {
         IsDeafened = model.Deaf.Value;
     }
     if (model.Mute.IsSpecified)
     {
         IsMuted = model.Mute.Value;
     }
     if (model.Roles.IsSpecified)
     {
         UpdateRoles(model.Roles.Value);
     }
     if (model.PremiumSince.IsSpecified)
     {
         _premiumSinceTicks = model.PremiumSince.Value?.UtcTicks;
     }
     if (model.Pending.IsSpecified)
     {
         IsPending = model.Pending.Value;
     }
 }
        internal static SocketGuildUser Create(SocketGuild guild, ClientState state, MemberModel model)
        {
            var entity = new SocketGuildUser(guild, guild.Discord.GetOrCreateUser(state, model.User));

            entity.Update(state, model);
            if (!model.Roles.IsSpecified)
            {
                entity.UpdateRoles(new ulong[0]);
            }
            return(entity);
        }
Example #5
0
 internal void Update(ClientState state, Model model)
 {
     base.Update(state, model.User);
     if (model.JoinedAt.IsSpecified)
     {
         _joinedAtTicks = model.JoinedAt.Value.UtcTicks;
     }
     if (model.Nick.IsSpecified)
     {
         Nickname = model.Nick.Value;
     }
     UpdateRoles(model.Roles);
 }
Example #6
0
 internal SocketGuildUser AddOrUpdateUser(MemberModel model)
 {
     if (_members.TryGetValue(model.User.Id, out SocketGuildUser member))
     {
         member.Update(Discord.State, model);
     }
     else
     {
         member = SocketGuildUser.Create(this, Discord.State, model);
         _members[member.Id] = member;
         DownloadedMemberCount++;
     }
     return(member);
 }
Example #7
0
 internal void Update(Model model)
 {
     if (model.JoinedAt.IsSpecified)
     {
         _joinedAtTicks = model.JoinedAt.Value.UtcTicks;
     }
     if (model.Nick.IsSpecified)
     {
         Nickname = model.Nick.Value;
     }
     IsDeafened = model.Deaf;
     IsMuted    = model.Mute;
     UpdateRoles(model.Roles);
 }
Example #8
0
        public void Update(Model model, UpdateSource source)
        {
            if (source == UpdateSource.Rest && IsAttached)
            {
                return;
            }

            //if (model.JoinedAt.IsSpecified)
            _joinedAtTicks = model.JoinedAt.UtcTicks;
            if (model.Nick.IsSpecified)
            {
                Nickname = model.Nick.Value;
            }

            //if (model.Roles.IsSpecified)
            UpdateRoles(model.Roles);
        }
Example #9
0
        public SocketGuildUser AddOrUpdateUser(MemberModel model, DataStore dataStore, ConcurrentDictionary <ulong, SocketGuildUser> members = null)
        {
            members = members ?? _members;

            SocketGuildUser member;

            if (members.TryGetValue(model.User.Id, out member))
            {
                member.Update(model, UpdateSource.WebSocket);
            }
            else
            {
                var user = Discord.GetOrAddUser(model.User, dataStore);
                member           = new SocketGuildUser(this, user, model);
                members[user.Id] = member;
                DownloadedMemberCount++;
            }
            return(member);
        }
 internal void Update(ClientState state, MemberModel model)
 {
     base.Update(state, model.User);
     if (model.JoinedAt.IsSpecified)
     {
         _joinedAtTicks = model.JoinedAt.Value.UtcTicks;
     }
     if (model.Nick.IsSpecified)
     {
         Nickname = model.Nick.Value;
     }
     if (model.Roles.IsSpecified)
     {
         UpdateRoles(model.Roles.Value);
     }
     if (model.PremiumSince.IsSpecified)
     {
         _premiumSinceTicks = model.PremiumSince.Value?.UtcTicks;
     }
 }
Example #11
0
        internal static RestGuildUser Create(BaseDiscordClient discord, IGuild guild, Model model)
        {
            var entity = new RestGuildUser(discord, guild, model.User.Id);

            entity.Update(model);
            return(entity);
        }
Example #12
0
 public SocketGuildUser(SocketGuild guild, SocketGlobalUser user, Model model)
     : base(guild, user, model)
 {
     //Presence = new Presence(null, UserStatus.Offline);
 }
Example #13
0
 public GuildUser(Guild guild, User user, Model model)
     : this(guild, user)
 {
     Update(model, UpdateSource.Creation);
 }