/// <summary> /// Adds a text or voice channel to be created with the guild. /// </summary> public CreateGuildOptions AddChannel(CreateGuildChannelOptions channel) { if (Channels == null) { Channels = new List <CreateGuildChannelOptions>(); } Channels.Add(channel); return(this); }
/// <summary> /// Creates a new text channel, voice channel, or channel category for a guild. /// <para>Requires <see cref="DiscordPermission.ManageChannels"/>.</para> /// </summary> /// <exception cref="ArgumentNullException"></exception> /// <exception cref="DiscordHttpApiException"></exception> public async Task <DiscordGuildChannel> CreateGuildChannel(Snowflake guildId, CreateGuildChannelOptions options) { if (options == null) { throw new ArgumentNullException(nameof(options)); } DiscordApiData requestData = options.Build(); DiscordApiData returnData = await rest.Post($"guilds/{guildId}/channels", $"guilds/{guildId}/channels").ConfigureAwait(false); return((DiscordGuildChannel)DeserializeChannelData(returnData)); }