DSharpPlus/Entities/Guild/DiscordGuild.cs
/// <summary>
/// Creates a new channel in this guild.
/// </summary>
/// <param name="name">Name of the new channel.</param>
/// <param name="type">Type of the new channel.</param>
/// <param name="parent">Category to put this channel in.</param>
/// <param name="topic">Topic of the channel.</param>
/// <param name="bitrate">Bitrate of the channel. Applies to voice only.</param>
/// <param name="userLimit">Maximum number of users in the channel. Applies to voice only.</param>
/// <param name="overwrites">Permission overwrites for this channel.</param>
/// <param name="nsfw">Whether the channel is to be flagged as not safe for work. Applies to text only.</param>
/// <param name="reason">Reason for audit logs.</param>
/// <param name="perUserRateLimit">Slow mode timeout for users.</param>
/// <returns>The newly-created channel.</returns>
/// <exception cref="Exceptions.UnauthorizedException">Thrown when the client does not have the <see cref="Permissions.ManageChannels"/> permission.</exception>
/// <exception cref="Exceptions.NotFoundException">Thrown when the guild does not exist.</exception>
/// <exception cref="Exceptions.BadRequestException">Thrown when an invalid parameter was provided.</exception>
/// <exception cref="Exceptions.ServerErrorException">Thrown when Discord is unable to process the request.</exception>
Creates a new channel in this guild.
Creates a new channel in this guild .
public Task<DiscordChannel> CreateChannelAsync(string name, ChannelType type, DiscordChannel parent = null, Optional<string> topic = default, int? bitrate = null, int? userLimit = null, IEnumerable<DiscordOverwriteBuilder> overwrites = null, bool? nsfw = null, Optional<int?> perUserRateLimit = default, string reason = null)
        {
            if (type != ChannelType.Text && type != ChannelType.Voice && type != ChannelType.Category && type != ChannelType.News && type != ChannelType.Store)
                throw new ArgumentException("Channel type must be text, voice, or category.", nameof(type));
            if (type == ChannelType.Category && parent != null)
                throw new ArgumentException("Cannot specify parent of a channel category.", nameof(parent));
            return this.Discord.ApiClient.CreateGuildChannelAsync(this.Id, name, type, parent?.Id, topic, bitrate, userLimit, overwrites, nsfw, perUserRateLimit, reason);
        }
public Task < DiscordChannel > CreateChannelAsync ( string name , ChannelType type , DiscordChannel parent = null , Optional < string > topic = default , int ? bitrate = null , int ? userLimit = null , IEnumerable < DiscordOverwriteBuilder > overwrites = null , bool ? nsfw = null , Optional < int ? > perUserRateLimit = default , string reason = null ) { if ( type != ChannelType . Text && type != ChannelType . Voice && type != ChannelType . Category && type != ChannelType . News && type != ChannelType . Store ) throw new ArgumentException ( " " , nameof ( type ) ) ; if ( type == ChannelType . Category && parent != null ) throw new ArgumentException ( " " , nameof ( parent ) ) ; return this . Discord . ApiClient . CreateGuildChannelAsync ( this . Id , name , type , parent ? . Id , topic , bitrate , userLimit , overwrites , nsfw , perUserRateLimit , reason ) ; }
Creates a new channel in this guild.
Creates a new channel in this guild .
// technically you can create news/store channels but not always
The newly-created channel.
The newly - created channel .
Thrown when the client does not have the  permission.
Thrown when the client does not have the permission .
Thrown when the guild does not exist.
Thrown when the guild does not exist .
Thrown when an invalid parameter was provided.
Thrown when an invalid parameter was provided .
Thrown when Discord is unable to process the request.
Thrown when Discord is unable to process the request .
name
string
Name of the new channel.
Name of the new channel .
type
ChannelType
Type of the new channel.
Type of the new channel .
parent
DiscordChannel
Category to put this channel in.
Category to put this channel in .
topic
Optional<string>
Topic of the channel.
Topic of the channel .
bitrate
int?
Bitrate of the channel. Applies to voice only.
Bitrate of the channel . Applies to voice only .
userLimit
int?
Maximum number of users in the channel. Applies to voice only.
Maximum number of users in the channel . Applies to voice only .
overwrites
IEnumerable<DiscordOverwriteBuilder>
Permission overwrites for this channel.
Permission overwrites for this channel .
nsfw
bool?
Whether the channel is to be flagged as not safe for work. Applies to text only.
Whether the channel is to be flagged as not safe for work . Applies to text only .
perUserRateLimit
Optional<int?>
Slow mode timeout for users.
Slow mode timeout for users .
reason
string
Reason for audit logs.
Reason for audit logs .