Method CreateChannelAsync
- Namespace
- DSharpPlus.Entities
- Assembly
- DSharpPlus.dll
CreateChannelAsync(string, DiscordChannelType, DiscordChannel?, Optional<string>, int?, int?, IEnumerable<DiscordOverwriteBuilder>?, bool?, Optional<int?>, DiscordVideoQualityMode?, int?, string?, DiscordAutoArchiveDuration?, DefaultReaction?, IEnumerable<DiscordForumTagBuilder>?, DiscordDefaultSortOrder?)
Creates a new channel in this guild.
public Task<DiscordChannel> CreateChannelAsync(string name, DiscordChannelType 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, DiscordVideoQualityMode? qualityMode = null, int? position = null, string? reason = null, DiscordAutoArchiveDuration? defaultAutoArchiveDuration = null, DefaultReaction? defaultReactionEmoji = null, IEnumerable<DiscordForumTagBuilder>? availableTags = null, DiscordDefaultSortOrder? defaultSortOrder = null)
Parameters
namestringName of the new channel.
typeDiscordChannelTypeType of the new channel.
parentDiscordChannelCategory to put this channel in.
topicOptional<string>Topic of the channel.
bitrateint?Bitrate of the channel. Applies to voice only.
userLimitint?Maximum number of users in the channel. Applies to voice only.
overwritesIEnumerable<DiscordOverwriteBuilder>Permission overwrites for this channel.
nsfwbool?Whether the channel is to be flagged as not safe for work. Applies to text only.
perUserRateLimitOptional<int?>Slow mode timeout for users.
qualityModeDiscordVideoQualityMode?Video quality mode of the channel. Applies to voice only.
positionint?Sorting position of the channel.
reasonstringReason for audit logs.
defaultAutoArchiveDurationDiscordAutoArchiveDuration?The default duration in which threads (or posts) will archive.
defaultReactionEmojiDefaultReactionIf applied to a forum, the default emoji to use for forum post reactions.
availableTagsIEnumerable<DiscordForumTagBuilder>The tags available for a post in this channel.
defaultSortOrderDiscordDefaultSortOrder?The default sorting order.
Returns
- Task<DiscordChannel>
The newly-created channel.
Exceptions
- UnauthorizedException
Thrown when the client does not have the ManageChannels permission.
- NotFoundException
Thrown when the guild does not exist.
- BadRequestException
Thrown when an invalid parameter was provided.
- ServerErrorException
Thrown when Discord is unable to process the request.