@@ -474,12 +474,13 @@ namespace Discord | |||||
/// Creates a new channel category in this guild. | /// Creates a new channel category in this guild. | ||||
/// </summary> | /// </summary> | ||||
/// <param name="name">The new name for the category.</param> | /// <param name="name">The new name for the category.</param> | ||||
/// <param name="func">The delegate containing the properties to be applied to the channel upon its creation.</param> | |||||
/// <param name="options">The options to be used when sending the request.</param> | /// <param name="options">The options to be used when sending the request.</param> | ||||
/// <returns> | /// <returns> | ||||
/// A task that represents the asynchronous creation operation. The task result contains the newly created | /// A task that represents the asynchronous creation operation. The task result contains the newly created | ||||
/// category channel. | /// category channel. | ||||
/// </returns> | /// </returns> | ||||
Task<ICategoryChannel> CreateCategoryAsync(string name, RequestOptions options = null); | |||||
Task<ICategoryChannel> CreateCategoryAsync(string name, Action<GuildChannelProperties> func = null, RequestOptions options = null); | |||||
/// <summary> | /// <summary> | ||||
/// Gets a collection of all the voice regions this guild can access. | /// Gets a collection of all the voice regions this guild can access. | ||||
@@ -189,11 +189,18 @@ namespace Discord.Rest | |||||
} | } | ||||
/// <exception cref="ArgumentNullException"><paramref name="name"/> is <c>null</c>.</exception> | /// <exception cref="ArgumentNullException"><paramref name="name"/> is <c>null</c>.</exception> | ||||
public static async Task<RestCategoryChannel> CreateCategoryChannelAsync(IGuild guild, BaseDiscordClient client, | public static async Task<RestCategoryChannel> CreateCategoryChannelAsync(IGuild guild, BaseDiscordClient client, | ||||
string name, RequestOptions options) | |||||
string name, RequestOptions options, Action<GuildChannelProperties> func = null) | |||||
{ | { | ||||
if (name == null) throw new ArgumentNullException(paramName: nameof(name)); | if (name == null) throw new ArgumentNullException(paramName: nameof(name)); | ||||
var args = new CreateGuildChannelParams(name, ChannelType.Category); | |||||
var props = new GuildChannelProperties(); | |||||
func?.Invoke(props); | |||||
var args = new CreateGuildChannelParams(name, ChannelType.Category) | |||||
{ | |||||
Position = props.Position | |||||
}; | |||||
var model = await client.ApiClient.CreateGuildChannelAsync(guild.Id, args, options).ConfigureAwait(false); | var model = await client.ApiClient.CreateGuildChannelAsync(guild.Id, args, options).ConfigureAwait(false); | ||||
return RestCategoryChannel.Create(client, guild, model); | return RestCategoryChannel.Create(client, guild, model); | ||||
} | } | ||||