Ejemplo n.º 1
0
        public override void Update(ChannelJsonModel model)
        {
            base.Update(model);

            if (model.Topic.HasValue)
            {
                Topic = model.Topic.Value;
            }

            if (model.Nsfw.HasValue)
            {
                IsNsfw = model.Nsfw.Value;
            }

            if (model.RateLimitPerUser.HasValue)
            {
                Slowmode = model.RateLimitPerUser.Value;
            }

            _type = model.Type;

            if (model.LastMessageId.HasValue)
            {
                LastMessageId = model.LastMessageId.Value;
            }

            if (model.LastPinTimestamp.HasValue)
            {
                LastPinTimestamp = model.LastPinTimestamp.Value;
            }
        }
Ejemplo n.º 2
0
        protected CachedChannel(IGatewayClient client, ChannelJsonModel model)
            : base(client, model.Id)
        {
            Type = model.Type;

            Update(model);
        }
Ejemplo n.º 3
0
 public virtual void Update(ChannelJsonModel model)
 {
     if (model.Name.HasValue)
     {
         Name = model.Name.Value;
     }
 }
        public static new TransientGuildChannel Create(IClient client, ChannelJsonModel model)
        {
            switch (model.Type)
            {
            case ChannelType.Text:
            case ChannelType.News:
                return(new TransientTextChannel(client, model));

            case ChannelType.Voice:
                return(new TransientVoiceChannel(client, model));

            case ChannelType.Category:
                return(new TransientCategoryChannel(client, model));

            case ChannelType.Store:
                return(new TransientStoreChannel(client, model));

            case ChannelType.NewsThread:
            case ChannelType.PublicThread:
            case ChannelType.PrivateThread:
                return(new TransientThreadChannel(client, model));

            case ChannelType.Stage:
                return(new TransientStageChannel(client, model));
            }

            return(new TransientUnknownGuildChannel(client, model));
        }
Ejemplo n.º 5
0
        public override void Update(ChannelJsonModel model)
        {
            base.Update(model);

            if (model.Member.HasValue)
            {
                CurrentMember = new TransientThreadMember(Client, model.Member.Value);
            }

            if (model.MessageCount.HasValue)
            {
                MessageCount = model.MessageCount.Value;
            }

            if (model.MemberCount.HasValue)
            {
                MemberCount = model.MemberCount.Value;
            }

            if (model.ThreadMetadata.HasValue)
            {
                var metadataModel = model.ThreadMetadata.Value;
                IsArchived = metadataModel.Archived;
                AutomaticArchiveDuration = TimeSpan.FromMinutes(metadataModel.AutoArchiveDuration);
                ArchiveStateChangedAt    = metadataModel.ArchiveTimestamp;
                IsLocked         = metadataModel.Locked.GetValueOrDefault();
                AllowsInvitation = metadataModel.Invitable.GetValueOrDefault(true);
            }
        }
Ejemplo n.º 6
0
        public static CachedGuildChannel Create(IGatewayClient client, ChannelJsonModel model)
        {
            switch (model.Type)
            {
            case ChannelType.Text:
            case ChannelType.News:
                return(new CachedTextChannel(client, model));

            case ChannelType.Voice:
                return(new CachedVoiceChannel(client, model));

            case ChannelType.Category:
                return(new CachedCategoryChannel(client, model));

            case ChannelType.Store:
                return(new CachedStoreChannel(client, model));

            case ChannelType.NewsThread:
            case ChannelType.PublicThread:
            case ChannelType.PrivateThread:
                return(new CachedThreadChannel(client, model));

            case ChannelType.Stage:
                return(new CachedStageChannel(client, model));
            }

            return(new CachedUnknownGuildChannel(client, model));
        }
Ejemplo n.º 7
0
        public override void Update(ChannelJsonModel model)
        {
            base.Update(model);

            if (model.Nsfw.HasValue)
            {
                IsNsfw = model.Nsfw.Value;
            }
        }
Ejemplo n.º 8
0
        public override void Update(ChannelJsonModel model)
        {
            base.Update(model);

            if (model.ParentId.HasValue)
            {
                CategoryId = model.ParentId.Value;
            }
        }
Ejemplo n.º 9
0
        public override void Update(ChannelJsonModel model)
        {
            base.Update(model);

            if (model.UserLimit.HasValue)
            {
                MemberLimit = model.UserLimit.Value;
            }
        }
Ejemplo n.º 10
0
        public CachedThreadChannel(IGatewayClient client, ChannelJsonModel model)
            : base(client, model)
        {
            ChannelId = model.ParentId.Value.Value;
            CreatorId = model.OwnerId.Value;

            if (model.ThreadMetadata.HasValue)
            {
                CreatedAt = model.ThreadMetadata.Value.CreateTimestamp.GetValueOrDefault();
            }
        }
Ejemplo n.º 11
0
            static ChannelJsonModel MatchMemberToThread(ChannelJsonModel threadModel, ThreadMemberJsonModel[] memberModels)
            {
                var memberModel = Array.Find(memberModels, x => x.Id == threadModel.Id);

                if (memberModel != null)
                {
                    threadModel.Member = memberModel;
                }

                return(threadModel);
            }
Ejemplo n.º 12
0
        public override void Update(ChannelJsonModel model)
        {
            base.Update(model);

            if (model.Position.HasValue)
            {
                Position = model.Position.Value;
            }

            if (model.PermissionOverwrites.HasValue)
            {
                Overwrites = model.PermissionOverwrites.Value.ToReadOnlyList(this, (x, @this) => new TransientOverwrite(@this.Client, @this.Id, x));
            }
        }
        public override void Update(ChannelJsonModel model)
        {
            base.Update(model);

            if (model.Bitrate.HasValue)
            {
                Bitrate = model.Bitrate.Value;
            }

            if (model.RtcRegion.HasValue)
            {
                Region = model.RtcRegion.Value;
            }
        }
Ejemplo n.º 14
0
        public override void Update(ChannelJsonModel model)
        {
            base.Update(model);

            if (model.Topic.HasValue)
            {
                Topic = model.Topic.Value;
            }

            if (model.Nsfw.HasValue)
            {
                IsNsfw = model.Nsfw.Value;
            }

            if (model.DefaultAutoArchiveDuration.HasValue)
            {
                DefaultAutomaticArchiveDuration = TimeSpan.FromMinutes(model.DefaultAutoArchiveDuration.Value);
            }
        }
Ejemplo n.º 15
0
        public override void Update(ChannelJsonModel model)
        {
            base.Update(model);

            if (model.RateLimitPerUser.HasValue)
            {
                Slowmode = TimeSpan.FromSeconds(model.RateLimitPerUser.Value);
            }

            if (model.LastMessageId.HasValue)
            {
                LastMessageId = model.LastMessageId.Value;
            }

            if (model.LastPinTimestamp.HasValue)
            {
                LastPinTimestamp = model.LastPinTimestamp.Value;
            }
        }
Ejemplo n.º 16
0
        public static CachedChannel Create(IGatewayClient client, ChannelJsonModel model)
        {
            switch (model.Type)
            {
            case ChannelType.Direct:
            case ChannelType.Group:
                // TODO: cached private channels?
                break;

            case ChannelType.Text:
            case ChannelType.Voice:
            case ChannelType.Category:
            case ChannelType.News:
            case ChannelType.Store:
            case ChannelType.Thread:
                return(CachedGuildChannel.Create(client, model));
            }

            return(null /*TransientUnknownChannel(client, model)*/);
        }
Ejemplo n.º 17
0
 public CachedNestableChannel(IGatewayClient client, Snowflake guildId, ChannelJsonModel model)
     : base(client, guildId, model)
 {
 }
Ejemplo n.º 18
0
 public CachedCategoryChannel(IGatewayClient client, ChannelJsonModel model)
     : base(client, model)
 {
 }
Ejemplo n.º 19
0
 public CachedStoreChannel(IGatewayClient client, ChannelJsonModel model)
     : base(client, model)
 {
 }
Ejemplo n.º 20
0
 protected TransientVocalGuildChannel(IClient client, ChannelJsonModel model)
     : base(client, model)
 {
 }
Ejemplo n.º 21
0
 protected CachedCategorizableGuildChannel(IGatewayClient client, ChannelJsonModel model)
     : base(client, model)
 {
 }
Ejemplo n.º 22
0
 public TransientDirectChannel(IClient client, ChannelJsonModel model)
     : base(client, model)
 {
 }
 public TransientCategoryChannel(IClient client, ChannelJsonModel model)
     : base(client, model)
 {
 }
Ejemplo n.º 24
0
 public TransientThreadChannel(IClient client, ChannelJsonModel model)
     : base(client, model)
 {
 }
Ejemplo n.º 25
0
 protected CachedGuildChannel(IGatewayClient client, ChannelJsonModel model)
     : base(client, model)
 {
     GuildId = model.GuildId.Value;
 }
Ejemplo n.º 26
0
 protected TransientMessageGuildChannel(IClient client, ChannelJsonModel model)
     : base(client, model)
 {
 }
Ejemplo n.º 27
0
 protected TransientPrivateChannel(IClient client, ChannelJsonModel model)
     : base(client, model)
 {
 }
 protected TransientCategorizableGuildChannel(IClient client, ChannelJsonModel model)
     : base(client, model)
 {
 }
Ejemplo n.º 29
0
 public TransientStoreChannel(IClient client, ChannelJsonModel model)
     : base(client, model)
 {
 }
Ejemplo n.º 30
0
 public CachedThreadChannel(IGatewayClient client, ChannelJsonModel model)
     : base(client, model)
 {
     ChannelId = model.ParentId.Value.Value;
     CreatorId = model.OwnerId.Value;
 }