Ejemplo n.º 1
0
        public Channel Modify(ChannelModProperties properties)
        {
            Channel channel = Client.ModifyChannel(Id, properties);

            Name                 = channel.Name;
            Topic                = channel.Topic;
            Position             = channel.Position;
            Nsfw                 = channel.Nsfw;
            ParentId             = channel.ParentId;
            PermissionOverwrites = channel.PermissionOverwrites;
            return(channel);
        }
Ejemplo n.º 2
0
        public static Channel ModifyChannel(this DiscordClient client, long channelId, ChannelModProperties properties)
        {
            var resp = client.HttpClient.Patch($"/channels/{channelId}", JsonConvert.SerializeObject(properties));

            if (resp.StatusCode == HttpStatusCode.NotFound)
            {
                throw new ChannelNotFoundException(client, channelId);
            }

            Channel channel = JsonConvert.DeserializeObject <Channel>(resp.Content.ReadAsStringAsync().Result);

            channel.Client = client;
            return(channel);
        }