diff --git a/src/Discord.Net.Core/Entities/Channels/TextChannelProperties.cs b/src/Discord.Net.Core/Entities/Channels/TextChannelProperties.cs
index 6dcbf860a..1beafd4e8 100644
--- a/src/Discord.Net.Core/Entities/Channels/TextChannelProperties.cs
+++ b/src/Discord.Net.Core/Entities/Channels/TextChannelProperties.cs
@@ -38,5 +38,15 @@ namespace Discord
///
/// Thrown if the value does not fall within [0, 120].
public Optional SlowModeInterval { get; set; }
+
+ ///
+ /// Gets or sets the type of channel.
+ /// Only setting to a is supported.
+ ///
+ ///
+ /// Setting this value to a different type will change the type of channel that is associated with this Id.
+ ///
+ /// Thrown if the type of channel that is being set is not valid.
+ public Optional Type { get; set; }
}
}
diff --git a/src/Discord.Net.Rest/API/Rest/ModifyTextChannelParams.cs b/src/Discord.Net.Rest/API/Rest/ModifyTextChannelParams.cs
index 94f149fc1..1451ec14b 100644
--- a/src/Discord.Net.Rest/API/Rest/ModifyTextChannelParams.cs
+++ b/src/Discord.Net.Rest/API/Rest/ModifyTextChannelParams.cs
@@ -12,5 +12,7 @@ namespace Discord.API.Rest
public Optional IsNsfw { get; set; }
[JsonProperty("rate_limit_per_user")]
public Optional SlowModeInterval { get; set; }
+ [JsonProperty("type")]
+ public Optional Type { get; set; }
}
}
diff --git a/src/Discord.Net.Rest/DiscordRestApiClient.cs b/src/Discord.Net.Rest/DiscordRestApiClient.cs
index b1e04e9dc..842f9d75d 100644
--- a/src/Discord.Net.Rest/DiscordRestApiClient.cs
+++ b/src/Discord.Net.Rest/DiscordRestApiClient.cs
@@ -377,6 +377,15 @@ namespace Discord.API
Preconditions.NotNullOrEmpty(args.Name, nameof(args.Name));
Preconditions.AtLeast(args.SlowModeInterval, 0, nameof(args.SlowModeInterval));
Preconditions.AtMost(args.SlowModeInterval, 120, nameof(args.SlowModeInterval));
+ if (args.Type.IsSpecified)
+ {
+ // can only change Text/NewsChannel into a Text or News
+ var warn = "You may not change a Text or News channel into a Voice, Group, DM, or Category channel.";
+ Preconditions.NotEqual((uint)args.Type.Value, (uint)ChannelType.Voice, nameof(args.Type), warn);
+ Preconditions.NotEqual((uint)args.Type.Value, (uint)ChannelType.Group, nameof(args.Type), warn);
+ Preconditions.NotEqual((uint)args.Type.Value, (uint)ChannelType.DM, nameof(args.Type), warn);
+ Preconditions.NotEqual((uint)args.Type.Value, (uint)ChannelType.Category, nameof(args.Type), warn);
+ }
options = RequestOptions.CreateOrClone(options);
var ids = new BucketIds(channelId: channelId);
diff --git a/src/Discord.Net.Rest/Entities/Channels/ChannelHelper.cs b/src/Discord.Net.Rest/Entities/Channels/ChannelHelper.cs
index d8a97e85a..e2fe8969c 100644
--- a/src/Discord.Net.Rest/Entities/Channels/ChannelHelper.cs
+++ b/src/Discord.Net.Rest/Entities/Channels/ChannelHelper.cs
@@ -46,6 +46,7 @@ namespace Discord.Rest
Topic = args.Topic,
IsNsfw = args.IsNsfw,
SlowModeInterval = args.SlowModeInterval,
+ Type = args.Type
};
return await client.ApiClient.ModifyGuildChannelAsync(channel.Id, apiArgs, options).ConfigureAwait(false);
}
diff --git a/src/Discord.Net.WebSocket/Entities/Channels/SocketNewsChannel.cs b/src/Discord.Net.WebSocket/Entities/Channels/SocketNewsChannel.cs
index 9918608c3..3eba4661e 100644
--- a/src/Discord.Net.WebSocket/Entities/Channels/SocketNewsChannel.cs
+++ b/src/Discord.Net.WebSocket/Entities/Channels/SocketNewsChannel.cs
@@ -19,5 +19,6 @@ namespace Discord.WebSocket
entity.Update(state, model);
return entity;
}
+ //TODO: Need to set custom channel properties for this type, as apparently it does not support slow mode or overwrites.
}
}