Ejemplo n.º 1
0
 protected void Update(TextChannel channel)
 {
     base.Update(channel);
     Topic    = channel.Topic;
     Nsfw     = channel.Nsfw;
     SlowMode = channel.SlowMode;
 }
Ejemplo n.º 2
0
        internal override Channel Clone()
        {
            var result = new TextChannel(Id, Server);

            _cloner(this, result);
            return(result);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Updates the channel's info
        /// </summary>
        public override void Update()
        {
            TextChannel channel = Client.GetTextChannel(Id);

            Name                 = channel.Name;
            Topic                = channel.Topic;
            Nsfw                 = channel.Nsfw;
            Position             = channel.Position;
            ParentId             = channel.ParentId;
            PermissionOverwrites = channel.PermissionOverwrites;
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Modifies the channel
        /// </summary>
        /// <param name="properties">Options for modifying the channel</param>
        public void Modify(TextChannelProperties properties)
        {
            TextChannel channel = Client.ModifyTextChannel(Id, properties);

            Name                 = channel.Name;
            Topic                = channel.Topic;
            Nsfw                 = channel.Nsfw;
            SlowMode             = channel.SlowMode;
            Position             = channel.Position;
            ParentId             = channel.ParentId;
            PermissionOverwrites = channel.PermissionOverwrites;
        }
Ejemplo n.º 5
0
        public void Modify(TextChannelProperties properties)
        {
            if (!properties.NameProperty.Set)
            {
                properties.Name = Name;
            }
            if (!properties.TopicProperty.Set)
            {
                properties.Topic = Topic;
            }
            if (!properties.NsfwProperty.Set)
            {
                properties.Nsfw = Nsfw;
            }
            if (!properties.SlowModeProperty.Set)
            {
                properties.SlowMode = SlowMode;
            }
            if (!properties.PositionProperty.Set)
            {
                properties.Position = Position;
            }
            if (!properties.ParentProperty.Set)
            {
                properties.ParentId = ParentId;
            }

            TextChannel channel = Client.ModifyTextChannel(Id, properties);

            Name                 = channel.Name;
            Topic                = channel.Topic;
            Nsfw                 = channel.Nsfw;
            SlowMode             = channel.SlowMode;
            Position             = channel.Position;
            ParentId             = channel.ParentId;
            PermissionOverwrites = channel.PermissionOverwrites;
        }
Ejemplo n.º 6
0
        internal PublicChannel AddChannel(APIChannel model, bool cachePerms)
        {
            PublicChannel channel;
            ChannelType   type = EnumConverters.ToChannelType(model.Type);

            if (type == ChannelType.Voice)
            {
                channel = new VoiceChannel(model, this);
            }
            else
            {
                channel = new TextChannel(model, this);
            }

            if (cachePerms && Client.Config.UsePermissionsCache)
            {
                foreach (var user in Users)
                {
                    channel.AddUser(user);
                }
            }
            Client.AddChannel(channel);
            return(_channels.GetOrAdd(model.Id, x => channel));
        }