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
name
stringName of the new channel.
type
DiscordChannelTypeType of the new channel.
parent
DiscordChannelCategory to put this channel in.
topic
Optional<string>Topic of the channel.
bitrate
int?Bitrate of the channel. Applies to voice only.
userLimit
int?Maximum number of users in the channel. Applies to voice only.
overwrites
IEnumerable<DiscordOverwriteBuilder>Permission overwrites for this channel.
nsfw
bool?Whether the channel is to be flagged as not safe for work. Applies to text only.
perUserRateLimit
Optional<int?>Slow mode timeout for users.
qualityMode
DiscordVideoQualityMode?Video quality mode of the channel. Applies to voice only.
position
int?Sorting position of the channel.
reason
stringReason for audit logs.
defaultAutoArchiveDuration
DiscordAutoArchiveDuration?The default duration in which threads (or posts) will archive.
defaultReactionEmoji
DefaultReactionIf applied to a forum, the default emoji to use for forum post reactions.
availableTags
IEnumerable<DiscordForumTagBuilder>The tags available for a post in this channel.
defaultSortOrder
DiscordDefaultSortOrder?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.