diff --git a/src/Discord.Net.Core/Discord.Net.Core.xml b/src/Discord.Net.Core/Discord.Net.Core.xml index 5ace1922d..6d415630e 100644 --- a/src/Discord.Net.Core/Discord.Net.Core.xml +++ b/src/Discord.Net.Core/Discord.Net.Core.xml @@ -4524,6 +4524,9 @@ The value of this choice. + + Discord only accepts int and string as the input. + @@ -4591,6 +4594,11 @@ Gets or sets the name of this command. + + + Whether the command is enabled by default when the app is added to a guild. Default is + + ApplicationCommandType is enum of current valid Application Command Types: Slash, User, Message @@ -4626,6 +4634,11 @@ The name of this Message command. + + + Whether the command is enabled by default when the app is added to a guild + + Build the current builder into a class. @@ -4643,6 +4656,13 @@ The current builder. + + + Sets the default permission of the current command. + + The default permission value to set. + The current builder. + A class used to create message commands. @@ -4663,6 +4683,11 @@ The name of this User command. + + + Whether the command is enabled by default when the app is added to a guild + + Build the current builder into a class. @@ -4678,6 +4703,13 @@ The current builder. + + + Sets the default permission of the current command. + + The default permission value to set. + The current builder. + A class used to create User commands. @@ -5379,22 +5411,22 @@ - Represents a class used to build 's. + Represents a class used to build 's. - The max length of a . + The max length of a . - The maximum number of values for the and properties. + The maximum number of values for the and properties. - The maximum number of options a can have. + The maximum number of options a can have. @@ -5438,9 +5470,9 @@ Creates a new instance of a . - + - Creates a new instance of a from instance of . + Creates a new instance of a from instance of . @@ -5539,9 +5571,9 @@ - Builds a + Builds a - The newly built + The newly built @@ -5715,45 +5747,45 @@ Returns a empty . - + Represents a select menu component defined at - + - + The custom id of this Select menu that will be sent with a . - + The menus options to select from. - + A custom placeholder text if nothing is selected, max 100 characters. - + The minimum number of items that must be chosen; default 1, min 0, max 25 - + The maximum number of items that can be chosen; default 1, max 25 - + Whether this menu is disabled or not. - + Turns this select menu into a builder. @@ -5763,7 +5795,7 @@ - Represents a choice for a . + Represents a choice for a . @@ -6038,11 +6070,6 @@ Gets or sets the options for this command. - - - Whether the command is enabled by default when the app is added to a guild. Default is - - Represents a generic invite object. diff --git a/src/Discord.Net.Core/Entities/Guilds/IGuild.cs b/src/Discord.Net.Core/Entities/Guilds/IGuild.cs index 83efb158b..76ff9eb4f 100644 --- a/src/Discord.Net.Core/Entities/Guilds/IGuild.cs +++ b/src/Discord.Net.Core/Entities/Guilds/IGuild.cs @@ -667,6 +667,17 @@ namespace Discord /// Task CreateVoiceChannelAsync(string name, Action func = null, RequestOptions options = null); /// + /// Creates a new stage channel in this guild. + /// + /// The new name for the stage channel. + /// The delegate containing the properties to be applied to the channel upon its creation. + /// The options to be used when sending the request. + /// + /// A task that represents the asynchronous creation operation. The task result contains the newly created + /// stage channel. + /// + Task CreateStageChannelAsync(string name, Action func = null, RequestOptions options = null); + /// /// Creates a new channel category in this guild. /// /// The new name for the category. diff --git a/src/Discord.Net.Rest/Entities/Guilds/GuildHelper.cs b/src/Discord.Net.Rest/Entities/Guilds/GuildHelper.cs index b1fb2f044..73f59b566 100644 --- a/src/Discord.Net.Rest/Entities/Guilds/GuildHelper.cs +++ b/src/Discord.Net.Rest/Entities/Guilds/GuildHelper.cs @@ -221,6 +221,34 @@ namespace Discord.Rest var model = await client.ApiClient.CreateGuildChannelAsync(guild.Id, args, options).ConfigureAwait(false); return RestVoiceChannel.Create(client, guild, model); } + public static async Task CreateStageChannelAsync(IGuild guild, BaseDiscordClient client, + string name, RequestOptions options, Action func = null) + { + if (name == null) + throw new ArgumentNullException(paramName: nameof(name)); + + var props = new VoiceChannelProperties(); + func?.Invoke(props); + + var args = new CreateGuildChannelParams(name, ChannelType.Stage) + { + CategoryId = props.CategoryId, + Bitrate = props.Bitrate, + UserLimit = props.UserLimit, + Position = props.Position, + Overwrites = props.PermissionOverwrites.IsSpecified + ? props.PermissionOverwrites.Value.Select(overwrite => new API.Overwrite + { + TargetId = overwrite.TargetId, + TargetType = overwrite.TargetType, + Allow = overwrite.Permissions.AllowValue.ToString(), + Deny = overwrite.Permissions.DenyValue.ToString() + }).ToArray() + : Optional.Create(), + }; + var model = await client.ApiClient.CreateGuildChannelAsync(guild.Id, args, options).ConfigureAwait(false); + return RestStageChannel.Create(client, guild, model); + } /// is null. public static async Task CreateCategoryChannelAsync(IGuild guild, BaseDiscordClient client, string name, RequestOptions options, Action func = null) diff --git a/src/Discord.Net.Rest/Entities/Guilds/RestGuild.cs b/src/Discord.Net.Rest/Entities/Guilds/RestGuild.cs index 5b9436970..3608c2d8b 100644 --- a/src/Discord.Net.Rest/Entities/Guilds/RestGuild.cs +++ b/src/Discord.Net.Rest/Entities/Guilds/RestGuild.cs @@ -663,6 +663,18 @@ namespace Discord.Rest public Task CreateVoiceChannelAsync(string name, Action func = null, RequestOptions options = null) => GuildHelper.CreateVoiceChannelAsync(this, Discord, name, options, func); /// + /// Creates a new stage channel in this guild. + /// + /// The new name for the stage channel. + /// The delegate containing the properties to be applied to the channel upon its creation. + /// The options to be used when sending the request. + /// + /// A task that represents the asynchronous creation operation. The task result contains the newly created + /// stage channel. + /// + public Task CreateStageChannelAsync(string name, Action func = null, RequestOptions options = null) + => GuildHelper.CreateStageChannelAsync(this, Discord, name, options, func); + /// /// Creates a category channel with the provided name. /// /// The name of the new channel. @@ -1241,6 +1253,9 @@ namespace Discord.Rest async Task IGuild.CreateVoiceChannelAsync(string name, Action func, RequestOptions options) => await CreateVoiceChannelAsync(name, func, options).ConfigureAwait(false); /// + async Task IGuild.CreateStageChannelAsync(string name, Action func, RequestOptions options) + => await CreateStageChannelAsync(name, func, options).ConfigureAwait(false); + /// async Task IGuild.CreateCategoryAsync(string name, Action func, RequestOptions options) => await CreateCategoryChannelAsync(name, func, options).ConfigureAwait(false); diff --git a/src/Discord.Net.WebSocket/Entities/Guilds/SocketGuild.cs b/src/Discord.Net.WebSocket/Entities/Guilds/SocketGuild.cs index 1d1175f52..0c211f394 100644 --- a/src/Discord.Net.WebSocket/Entities/Guilds/SocketGuild.cs +++ b/src/Discord.Net.WebSocket/Entities/Guilds/SocketGuild.cs @@ -746,6 +746,19 @@ namespace Discord.WebSocket /// public Task CreateVoiceChannelAsync(string name, Action func = null, RequestOptions options = null) => GuildHelper.CreateVoiceChannelAsync(this, Discord, name, options, func); + + /// + /// Creates a new stage channel in this guild. + /// + /// The new name for the stage channel. + /// The delegate containing the properties to be applied to the channel upon its creation. + /// The options to be used when sending the request. + /// + /// A task that represents the asynchronous creation operation. The task result contains the newly created + /// stage channel. + /// + public Task CreateStageChannelAsync(string name, Action func = null, RequestOptions options = null) + => GuildHelper.CreateStageChannelAsync(this, Discord, name, options, func); /// /// Creates a new channel category in this guild. /// @@ -1650,6 +1663,9 @@ namespace Discord.WebSocket async Task IGuild.CreateVoiceChannelAsync(string name, Action func, RequestOptions options) => await CreateVoiceChannelAsync(name, func, options).ConfigureAwait(false); /// + async Task IGuild.CreateStageChannelAsync(string name, Action func, RequestOptions options) + => await CreateStageChannelAsync(name, func, options).ConfigureAwait(false); + /// async Task IGuild.CreateCategoryAsync(string name, Action func, RequestOptions options) => await CreateCategoryChannelAsync(name, func, options).ConfigureAwait(false);