Class SlashCommandOptionBuilder
Represents a class used to build options for the Discord.SlashCommandBuilder.
Assembly: Discord.Net.Core.dll​
View Source​
public class SlashCommandOptionBuilder
Properties​
Name​
Gets or sets the name of this option.
View Source​
public string Name { get; set; }
Description​
Gets or sets the description of this option.
View Source​
public string Description { get; set; }
Type​
Gets or sets the type of this option.
View Source​
public ApplicationCommandOptionType Type { get; set; }
IsDefault​
Gets or sets whether or not this options is the first required option for the user to complete. only one option can be default.
View Source​
public bool? IsDefault { get; set; }
IsRequired​
Gets or sets if the option is required.
View Source​
public bool? IsRequired { get; set; }
IsAutocomplete​
Gets or sets whether or not this option supports autocomplete.
View Source​
public bool IsAutocomplete { get; set; }
MinValue​
Gets or sets the smallest number value the user can input.
View Source​
public double? MinValue { get; set; }
MaxValue​
Gets or sets the largest number value the user can input.
View Source​
public double? MaxValue { get; set; }
Choices​
Gets or sets the choices for string and int types for the user to pick from.
View Source​
public List<ApplicationCommandOptionChoiceProperties> Choices { get; set; }
Options​
Gets or sets if this option is a subcommand or subcommand group type, these nested options will be the parameters.
View Source​
public List<SlashCommandOptionBuilder> Options { get; set; }
ChannelTypes​
Gets or sets the allowed channel types for this option.
View Source​
public List<ChannelType> ChannelTypes { get; set; }
Fields​
ChoiceNameMaxLength​
The max length of a choice's name allowed by Discord.
View Source​
public const int ChoiceNameMaxLength = 100
MaxChoiceCount​
The maximum number of choices allowed by Discord.
View Source​
public const int MaxChoiceCount = 25
Methods​
Build()​
Builds the current option.
View Source​
public ApplicationCommandOptionProperties Build()
Returns​
Discord.ApplicationCommandOptionProperties: The built version of this option.### AddOption(String, ApplicationCommandOptionType, String, Nullable<Boolean>, Boolean, Boolean, Nullable<Double>, Nullable<Double>, List<SlashCommandOptionBuilder>, List<ChannelType>, ApplicationCommandOptionChoiceProperties[]) Adds an option to the current slash command.
View Source​
public SlashCommandOptionBuilder AddOption(string name, ApplicationCommandOptionType type, string description, bool? required = null, bool isDefault = false, bool isAutocomplete = false, double? minValue = null, double? maxValue = null, List<SlashCommandOptionBuilder> options = null, List<ChannelType> channelTypes = null, params ApplicationCommandOptionChoiceProperties[] choices)
Returns​
Discord.SlashCommandOptionBuilder: The current builder.
Parameters​
Type | Name | Description |
---|---|---|
System.String | name | The name of the option to add. |
Discord.ApplicationCommandOptionType | type | The type of this option. |
System.String | description | The description of this option. |
System.Nullable<System.Boolean> | required | |
System.Boolean | isDefault | If this option is the default option. |
System.Boolean | isAutocomplete | If this option supports autocomplete. |
System.Nullable<System.Double> | minValue | The smallest number value the user can input. |
System.Nullable<System.Double> | maxValue | The largest number value the user can input. |
System.Collections.Generic.List<Discord.SlashCommandOptionBuilder> | options | The options of the option to add. |
System.Collections.Generic.List<Discord.ChannelType> | channelTypes | The allowed channel types for this option. |
Discord.ApplicationCommandOptionChoiceProperties[] | choices | The choices of this option. |
AddOption(SlashCommandOptionBuilder)​
Adds a sub option to the current option.
View Source​
public SlashCommandOptionBuilder AddOption(SlashCommandOptionBuilder option)
Returns​
Discord.SlashCommandOptionBuilder: The current builder.
Parameters​
Type | Name | Description |
---|---|---|
Discord.SlashCommandOptionBuilder | option | The sub option to add. |
AddChoice(String, Int32)​
Adds a choice to the current option.
View Source​
public SlashCommandOptionBuilder AddChoice(string name, int value)
Returns​
Discord.SlashCommandOptionBuilder: The current builder.
Parameters​
Type | Name | Description |
---|---|---|
System.String | name | The name of the choice. |
System.Int32 | value | The value of the choice. |
AddChoice(String, String)​
Adds a choice to the current option.
View Source​
public SlashCommandOptionBuilder AddChoice(string name, string value)
Returns​
Discord.SlashCommandOptionBuilder: The current builder.
Parameters​
Type | Name | Description |
---|---|---|
System.String | name | The name of the choice. |
System.String | value | The value of the choice. |
AddChoice(String, Double)​
Adds a choice to the current option.
View Source​
public SlashCommandOptionBuilder AddChoice(string name, double value)
Returns​
Discord.SlashCommandOptionBuilder: The current builder.
Parameters​
Type | Name | Description |
---|---|---|
System.String | name | The name of the choice. |
System.Double | value | The value of the choice. |
AddChoice(String, Single)​
Adds a choice to the current option.
View Source​
public SlashCommandOptionBuilder AddChoice(string name, float value)
Returns​
Discord.SlashCommandOptionBuilder: The current builder.
Parameters​
Type | Name | Description |
---|---|---|
System.String | name | The name of the choice. |
System.Single | value | The value of the choice. |
AddChoice(String, Int64)​
Adds a choice to the current option.
View Source​
public SlashCommandOptionBuilder AddChoice(string name, long value)
Returns​
Discord.SlashCommandOptionBuilder: The current builder.
Parameters​
Type | Name | Description |
---|---|---|
System.String | name | The name of the choice. |
System.Int64 | value | The value of the choice. |
AddChannelType(ChannelType)​
Adds a channel type to the current option.
View Source​
public SlashCommandOptionBuilder AddChannelType(ChannelType channelType)
Returns​
Discord.SlashCommandOptionBuilder: The current builder.
Parameters​
Type | Name | Description |
---|---|---|
Discord.ChannelType | channelType | The Discord.ChannelType to add. |
WithName(String)​
Sets the current builders name.
View Source​
public SlashCommandOptionBuilder WithName(string name)
Returns​
Discord.SlashCommandOptionBuilder: The current builder.
Parameters​
Type | Name | Description |
---|---|---|
System.String | name | The name to set the current option builder. |
WithDescription(String)​
Sets the current builders description.
View Source​
public SlashCommandOptionBuilder WithDescription(string description)
Returns​
Discord.SlashCommandOptionBuilder: The current builder.
Parameters​
Type | Name | Description |
---|---|---|
System.String | description | The description to set. |
WithRequired(Boolean)​
Sets the current builders required field.
View Source​
public SlashCommandOptionBuilder WithRequired(bool value)
Returns​
Discord.SlashCommandOptionBuilder: The current builder.
Parameters​
Type | Name | Description |
---|---|---|
System.Boolean | value | The value to set. |
WithDefault(Boolean)​
Sets the current builders default field.
View Source​
public SlashCommandOptionBuilder WithDefault(bool value)
Returns​
Discord.SlashCommandOptionBuilder: The current builder.
Parameters​
Type | Name | Description |
---|---|---|
System.Boolean | value | The value to set. |
WithAutocomplete(Boolean)​
Sets the current builders autocomplete field.
View Source​
public SlashCommandOptionBuilder WithAutocomplete(bool value)
Returns​
Discord.SlashCommandOptionBuilder: The current builder.
Parameters​
Type | Name | Description |
---|---|---|
System.Boolean | value | The value to set. |
WithMinValue(Double)​
Sets the current builders min value field.
View Source​
public SlashCommandOptionBuilder WithMinValue(double value)
Returns​
Discord.SlashCommandOptionBuilder: The current builder.
Parameters​
Type | Name | Description |
---|---|---|
System.Double | value | The value to set. |
WithMaxValue(Double)​
Sets the current builders max value field.
View Source​
public SlashCommandOptionBuilder WithMaxValue(double value)
Returns​
Discord.SlashCommandOptionBuilder: The current builder.
Parameters​
Type | Name | Description |
---|---|---|
System.Double | value | The value to set. |
WithType(ApplicationCommandOptionType)​
Sets the current type of this builder.
View Source​
public SlashCommandOptionBuilder WithType(ApplicationCommandOptionType type)
Returns​
Discord.SlashCommandOptionBuilder: The current builder.
Parameters​
Type | Name | Description |
---|---|---|
Discord.ApplicationCommandOptionType | type | The type to set. |