Class SlashCommandOptionAttribute
Makes a parameter available as an slash command option.
Inherited Members
Namespace: Color_Chan.Discord.Commands.Attributes
Assembly: Color-Chan.Discord.Commands.dll
Syntax
[AttributeUsage(AttributeTargets.Parameter)]
public class SlashCommandOptionAttribute : Attribute
Constructors
| Improve this Doc View SourceSlashCommandOptionAttribute(String, String)
Initializes a new instance of SlashCommandOptionAttribute.
Declaration
public SlashCommandOptionAttribute(string name, string description)
Parameters
Type | Name | Description |
---|---|---|
String | name | The name of the option. |
String | description | The description of the option. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | Thrown when |
SlashCommandOptionAttribute(String, String, DiscordApplicationCommandOptionType)
Initializes a new instance of SlashCommandOptionAttribute.
Declaration
public SlashCommandOptionAttribute(string name, string description, DiscordApplicationCommandOptionType type)
Parameters
Type | Name | Description |
---|---|---|
String | name | The name of the option. |
String | description | The description of the option. |
DiscordApplicationCommandOptionType | type | The type of the option. Will be automatically set to the correct type when set to null. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | Thrown when |
SlashCommandOptionAttribute(String, String, DiscordApplicationCommandOptionType, DiscordChannelType[])
Initializes a new instance of SlashCommandOptionAttribute.
Declaration
public SlashCommandOptionAttribute(string name, string description, DiscordApplicationCommandOptionType type, params DiscordChannelType[] chanelTypes)
Parameters
Type | Name | Description |
---|---|---|
String | name | The name of the option. |
String | description | The description of the option. |
DiscordApplicationCommandOptionType | type | The type of the option. Will be automatically set to the correct type when set to null. |
DiscordChannelType[] | chanelTypes | The channel type that will be shown if the supplied option |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | Thrown when |
SlashCommandOptionAttribute(String, String, DiscordApplicationCommandOptionType, Int32, Int32)
Initializes a new instance of SlashCommandOptionAttribute.
Declaration
public SlashCommandOptionAttribute(string name, string description, DiscordApplicationCommandOptionType type, int min, int max)
Parameters
Type | Name | Description |
---|---|---|
String | name | The name of the option. |
String | description | The description of the option. |
DiscordApplicationCommandOptionType | type | The type of the option. Will be automatically set to the correct type when set to null. |
Int32 | min | The minimum value if the supplied option |
Int32 | max | The maximum value if the supplied option |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | Thrown when |
SlashCommandOptionAttribute(String, String, Boolean)
Initializes a new instance of SlashCommandOptionAttribute.
Declaration
public SlashCommandOptionAttribute(string name, string description, bool isRequired)
Parameters
Type | Name | Description |
---|---|---|
String | name | The name of the option. |
String | description | The description of the option. |
Boolean | isRequired | Whether or not the option is required. |
Exceptions
Type | Condition |
---|---|
System.ArgumentException | Thrown when |
ArgumentNullException | Thrown when |
SlashCommandOptionAttribute(String, String, Boolean, DiscordApplicationCommandOptionType)
Initializes a new instance of SlashCommandOptionAttribute.
Declaration
public SlashCommandOptionAttribute(string name, string description, bool isRequired, DiscordApplicationCommandOptionType type)
Parameters
Type | Name | Description |
---|---|---|
String | name | The name of the option. |
String | description | The description of the option. |
Boolean | isRequired | Whether or not the option is required. |
DiscordApplicationCommandOptionType | type | The type of the option. Will be automatically set to the correct type when set to null. |
Exceptions
Type | Condition |
---|---|
System.ArgumentException | Thrown when |
ArgumentNullException | Thrown when |
SlashCommandOptionAttribute(String, String, Boolean, DiscordApplicationCommandOptionType, DiscordChannelType[])
Initializes a new instance of SlashCommandOptionAttribute.
Declaration
public SlashCommandOptionAttribute(string name, string description, bool isRequired, DiscordApplicationCommandOptionType type, params DiscordChannelType[] chanelTypes)
Parameters
Type | Name | Description |
---|---|---|
String | name | The name of the option. |
String | description | The description of the option. |
Boolean | isRequired | Whether or not the option is required. |
DiscordApplicationCommandOptionType | type | The type of the option. Will be automatically set to the correct type when set to null. |
DiscordChannelType[] | chanelTypes | The channel type that will be shown if the supplied option |
Exceptions
Type | Condition |
---|---|
System.ArgumentException | Thrown when |
ArgumentNullException | Thrown when |
SlashCommandOptionAttribute(String, String, Boolean, DiscordApplicationCommandOptionType, Int32, Int32)
Initializes a new instance of SlashCommandOptionAttribute.
Declaration
public SlashCommandOptionAttribute(string name, string description, bool isRequired, DiscordApplicationCommandOptionType type, int min, int max)
Parameters
Type | Name | Description |
---|---|---|
String | name | The name of the option. |
String | description | The description of the option. |
Boolean | isRequired | Whether or not the option is required. |
DiscordApplicationCommandOptionType | type | The type of the option. Will be automatically set to the correct type when set to null. |
Int32 | min | The minimum value if the supplied option |
Int32 | max | The maximum value if the supplied option |
Exceptions
Type | Condition |
---|---|
System.ArgumentException | Thrown when |
ArgumentNullException | Thrown when |
Properties
| Improve this Doc View SourceAutocomplete
Enable autocomplete interactions for this option.
Declaration
public bool? Autocomplete { get; set; }
Property Value
Type | Description |
---|---|
System.Nullable<Boolean> |
ChanelTypes
If the option is a channel type, the channels shown will be restricted to these types.
Declaration
public IEnumerable<DiscordChannelType> ChanelTypes { get; set; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<DiscordChannelType> |
Description
The description of the option.
Declaration
public string Description { get; set; }
Property Value
Type | Description |
---|---|
String |
IsRequired
Whether or not the option is required.
Declaration
public bool? IsRequired { get; }
Property Value
Type | Description |
---|---|
System.Nullable<Boolean> |
MaxValue
If the option is an INTEGER or NUMBER type, the maximum value permitted.
Declaration
public int? MaxValue { get; set; }
Property Value
Type | Description |
---|---|
System.Nullable<Int32> |
MinValue
If the option is an INTEGER or NUMBER type, the minimum value permitted.
Declaration
public int? MinValue { get; set; }
Property Value
Type | Description |
---|---|
System.Nullable<Int32> |
Name
The name of the option..
Declaration
public string Name { get; set; }
Property Value
Type | Description |
---|---|
String |
Type
The type of the option. Will be automatically set to the correct type when set to null.
Declaration
public DiscordApplicationCommandOptionType? Type { get; }
Property Value
Type | Description |
---|---|
System.Nullable<DiscordApplicationCommandOptionType> |