예제 #1
0
 internal void Update(Model model)
 {
     base.Update(model);
     IsTemporary     = model.Temporary;
     MaxAge          = model.MaxAge;
     MaxUses         = model.MaxUses;
     Uses            = model.Uses;
     _createdAtTicks = model.CreatedAt.UtcTicks;
 }
예제 #2
0
 internal void Update(Model model)
 {
     base.Update(model);
     Inviter         = RestUser.Create(Discord, model.Inviter);
     IsRevoked       = model.Revoked;
     IsTemporary     = model.Temporary;
     MaxAge          = model.MaxAge != 0 ? model.MaxAge : (int?)null;
     MaxUses         = model.MaxUses;
     Uses            = model.Uses;
     _createdAtTicks = model.CreatedAt.UtcTicks;
 }
예제 #3
0
        internal void Update(Model model)
        {
            base.Update(model);
            Inviter = model.Inviter != null?RestUser.Create(Discord, model.Inviter) : null;

            IsRevoked       = model.Revoked;
            IsTemporary     = model.Temporary;
            MaxAge          = model.MaxAge.IsSpecified ? model.MaxAge.Value : (int?)null;
            MaxUses         = model.MaxUses.IsSpecified ? model.MaxUses.Value : (int?)null;
            Uses            = model.Uses.IsSpecified ? model.Uses.Value : (int?)null;
            _createdAtTicks = model.CreatedAt.IsSpecified ? model.CreatedAt.Value.UtcTicks : (long?)null;
        }
예제 #4
0
        public void Update(Model model, UpdateSource source)
        {
            if (source == UpdateSource.Rest && IsAttached)
            {
                return;
            }

            Inviter         = new User(model.Inviter);
            IsRevoked       = model.Revoked;
            IsTemporary     = model.Temporary;
            MaxAge          = model.MaxAge != 0 ? model.MaxAge : (int?)null;
            MaxUses         = model.MaxUses;
            Uses            = model.Uses;
            _createdAtTicks = model.CreatedAt.UtcTicks;
        }
예제 #5
0
        internal static RestInviteMetadata Create(BaseDiscordClient discord, IGuild guild, IChannel channel, Model model)
        {
            var entity = new RestInviteMetadata(discord, guild, channel, model.Code);

            entity.Update(model);
            return(entity);
        }
예제 #6
0
 public InviteMetadata(DiscordRestClient client, Model model)
     : base(client, model)
 {
     Update(model, UpdateSource.Creation);
 }