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

            entity.Update(state, model);
            return(entity);
        }
Beispiel #2
0
 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.Pending.IsSpecified)
     {
         IsPending = model.Pending.Value;
     }
     if (model.Roles.IsSpecified)
     {
         UpdateRoles(model.Roles.Value);
     }
     if (model.PremiumSince.IsSpecified)
     {
         _premiumSinceTicks = model.PremiumSince.Value?.UtcTicks;
     }
 }
 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;
     }
     if (model.Pending.IsSpecified)
     {
         IsPending = model.Pending.Value;
     }
 }
Beispiel #4
0
        internal static RestGuildUser Create(BaseDiscordClient discord, IGuild guild, Model model)
        {
            RestGuildUser entity = new RestGuildUser(discord, guild, model.User.Id);

            entity.Update(model);
            return(entity);
        }
Beispiel #5
0
        /// <inheritdoc />
        public override async Task UpdateAsync(RequestOptions options = null)
        {
            Model model = await Discord.ApiClient.GetGuildMemberAsync(GuildId, Id, options).ConfigureAwait(false);

            Update(model);
        }