@@ -424,6 +424,19 @@ namespace Discord | |||||
/// <summary> | /// <summary> | ||||
/// Creates a new text channel in this guild. | /// Creates a new text channel in this guild. | ||||
/// </summary> | /// </summary> | ||||
/// <example> | |||||
/// The following example creates a new text channel under an existing category named <c>Wumpus</c> with a set topic. | |||||
/// <code lang="cs"> | |||||
/// var categories = await guild.GetCategoriesAsync(); | |||||
/// var targetCategory = categories.FirstOrDefault(x => x.Name == "wumpus"); | |||||
/// if (targetCategory == null) return; | |||||
/// await Context.Guild.CreateTextChannelAsync(name, x => | |||||
/// { | |||||
/// x.CategoryId = targetCategory.Id; | |||||
/// x.Topic = $"This channel was created at {DateTimeOffset.UtcNow} by {user}."; | |||||
/// }); | |||||
/// </code> | |||||
/// </example> | |||||
/// <param name="name">The new name for the text channel.</param> | /// <param name="name">The new name for the text channel.</param> | ||||
/// <param name="func">The delegate containing the properties to be applied to the channel upon its creation.</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> | ||||
@@ -395,14 +395,27 @@ namespace Discord.Rest | |||||
return null; | return null; | ||||
} | } | ||||
/// <summary> | /// <summary> | ||||
/// Creates a text channel with the provided name. | |||||
/// </summary> | |||||
/// <param name="name">The name of the new channel.</param> | |||||
/// <param name="options">The options to be used when sending the request.</param> | |||||
/// Creates a new text channel in this guild. | |||||
/// </summary> | |||||
/// <example> | |||||
/// The following example creates a new text channel under an existing category named <c>Wumpus</c> with a set topic. | |||||
/// <code lang="cs"> | |||||
/// var categories = await guild.GetCategoriesAsync(); | |||||
/// var targetCategory = categories.FirstOrDefault(x => x.Name == "wumpus"); | |||||
/// if (targetCategory == null) return; | |||||
/// await Context.Guild.CreateTextChannelAsync(name, x => | |||||
/// { | |||||
/// x.CategoryId = targetCategory.Id; | |||||
/// x.Topic = $"This channel was created at {DateTimeOffset.UtcNow} by {user}."; | |||||
/// }); | |||||
/// </code> | |||||
/// </example> | |||||
/// <param name="name">The new name for the text channel.</param> | |||||
/// <param name="func">The delegate containing the properties to be applied to the channel upon its creation.</param> | /// <param name="func">The delegate containing the properties to be applied to the channel upon its creation.</param> | ||||
/// <exception cref="ArgumentNullException"><paramref name="name" /> is <c>null</c>.</exception> | |||||
/// <param name="options">The options to be used when sending the request.</param> | |||||
/// <returns> | /// <returns> | ||||
/// The created text channel. | |||||
/// A task that represents the asynchronous creation operation. The task result contains the newly created | |||||
/// text channel. | |||||
/// </returns> | /// </returns> | ||||
public Task<RestTextChannel> CreateTextChannelAsync(string name, Action<TextChannelProperties> func = null, RequestOptions options = null) | public Task<RestTextChannel> CreateTextChannelAsync(string name, Action<TextChannelProperties> func = null, RequestOptions options = null) | ||||
=> GuildHelper.CreateTextChannelAsync(this, Discord, name, options, func); | => GuildHelper.CreateTextChannelAsync(this, Discord, name, options, func); | ||||
@@ -516,10 +516,22 @@ namespace Discord.WebSocket | |||||
/// <summary> | /// <summary> | ||||
/// Creates a new text channel in this guild. | /// Creates a new text channel in this guild. | ||||
/// </summary> | /// </summary> | ||||
/// <example> | |||||
/// The following example creates a new text channel under an existing category named <c>Wumpus</c> with a set topic. | |||||
/// <code lang="cs"> | |||||
/// var categories = await guild.GetCategoriesAsync(); | |||||
/// var targetCategory = categories.FirstOrDefault(x => x.Name == "wumpus"); | |||||
/// if (targetCategory == null) return; | |||||
/// await Context.Guild.CreateTextChannelAsync(name, x => | |||||
/// { | |||||
/// x.CategoryId = targetCategory.Id; | |||||
/// x.Topic = $"This channel was created at {DateTimeOffset.UtcNow} by {user}."; | |||||
/// }); | |||||
/// </code> | |||||
/// </example> | |||||
/// <param name="name">The new name for the text channel.</param> | /// <param name="name">The new name for the text channel.</param> | ||||
/// <param name="func">The delegate containing the properties to be applied to the channel upon its creation.</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> | ||||
/// <exception cref="ArgumentNullException"><paramref name="name"/> is <c>null</c>.</exception> | |||||
/// <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 | ||||
/// text channel. | /// text channel. | ||||