Package org.javacord.api.interaction
Interface SlashCommandOption
-
public interface SlashCommandOptionAn slash command's option (i.e., a parameter for the command).
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description static SlashCommandOptioncreate(SlashCommandOptionType type, java.lang.String name, java.lang.String description)Create a new slash command option to be used with a slash command builder.static SlashCommandOptioncreate(SlashCommandOptionType type, java.lang.String name, java.lang.String description, boolean required)Create a new slash command option to be used with a slash command builder.static SlashCommandOptioncreateAttachmentOption(java.lang.String name, java.lang.String description, boolean required)Create a newSlashCommandOptionType.ATTACHMENTslash command option to be used with a slash command builder.static SlashCommandOptioncreateBooleanOption(java.lang.String name, java.lang.String description, boolean required)Create a newSlashCommandOptionType.BOOLEANslash command option to be used with a slash command builder.static SlashCommandOptioncreateChannelOption(java.lang.String name, java.lang.String description, boolean required, java.util.Collection<ChannelType> channelTypes)Create a new slash command option to be used with a slash command builder.static SlashCommandOptioncreateDecimalOption(java.lang.String name, java.lang.String description, boolean required)Create a newSlashCommandOptionType.DECIMALslash command option to be used with a slash command builder.static SlashCommandOptioncreateDecimalOption(java.lang.String name, java.lang.String description, boolean required, boolean autocomplete)Create a newSlashCommandOptionType.DECIMALslash command option to be used with a slash command builder.static SlashCommandOptioncreateDecimalOption(java.lang.String name, java.lang.String description, boolean required, double minValue, double maxValue)Create a newSlashCommandOptionType.DECIMALslash command option to be used with a slash command builder.static SlashCommandOptioncreateLongOption(java.lang.String name, java.lang.String description, boolean required)Create a newSlashCommandOptionType.LONGslash command option to be used with a slash command builder.static SlashCommandOptioncreateLongOption(java.lang.String name, java.lang.String description, boolean required, boolean autocomplete)Create a newSlashCommandOptionType.LONGslash command option to be used with a slash command builder.static SlashCommandOptioncreateLongOption(java.lang.String name, java.lang.String description, boolean required, long minValue, long maxValue)Create a newSlashCommandOptionType.LONGslash command option to be used with a slash command builder.static SlashCommandOptioncreateMentionableOption(java.lang.String name, java.lang.String description, boolean required)Create a newSlashCommandOptionType.MENTIONABLEslash command option to be used with a slash command builder.static SlashCommandOptioncreateRoleOption(java.lang.String name, java.lang.String description, boolean required)Create a newSlashCommandOptionType.ROLEslash command option to be used with a slash command builder.static SlashCommandOptioncreateStringOption(java.lang.String name, java.lang.String description, boolean required)Create a newSlashCommandOptionType.STRINGslash command option to be used with a slash command builder.static SlashCommandOptioncreateStringOption(java.lang.String name, java.lang.String description, boolean required, boolean autocomplete)Create a newSlashCommandOptionType.STRINGslash command option to be used with a slash command builder.static SlashCommandOptioncreateUserOption(java.lang.String name, java.lang.String description, boolean required)Create a newSlashCommandOptionType.USERslash command option to be used with a slash command builder.static SlashCommandOptioncreateWithChoices(SlashCommandOptionType type, java.lang.String name, java.lang.String description, boolean required, java.util.List<SlashCommandOptionChoice> choices)Create a new slash command option to be used with a slash command builder.static SlashCommandOptioncreateWithChoices(SlashCommandOptionType type, java.lang.String name, java.lang.String description, boolean required, SlashCommandOptionChoiceBuilder... choices)Create a new slash command option to be used with a slash command builder.static SlashCommandOptioncreateWithOptions(SlashCommandOptionType type, java.lang.String name, java.lang.String description, java.util.List<SlashCommandOption> options)Create a new subcommand or subcommand group to be used with a slash command builder.static SlashCommandOptioncreateWithOptions(SlashCommandOptionType type, java.lang.String name, java.lang.String description, SlashCommandOptionBuilder... options)Create a new subcommand or subcommand group to be used with a slash command builder.java.util.Set<ChannelType>getChannelTypes()If the option is of typeSlashCommandOptionType.CHANNEL, the channels shown will be restricted to these types.java.util.List<SlashCommandOptionChoice>getChoices()Gets a list with all choices for this option.java.util.Optional<java.lang.Double>getDecimalMaxValue()If the option is anSlashCommandOptionType.DECIMALtype, the maximum value permitted.java.util.Optional<java.lang.Double>getDecimalMinValue()If the option is anSlashCommandOptionType.DECIMALtype, the minimum value permitted.java.lang.StringgetDescription()Gets the description of this option.java.util.Map<DiscordLocale,java.lang.String>getDescriptionLocalizations()Gets the description localizations for this option.java.util.Optional<java.lang.Long>getLongMaxValue()If the option is anSlashCommandOptionType.LONGtype, the maximum value permitted.java.util.Optional<java.lang.Long>getLongMinValue()If the option is anSlashCommandOptionType.LONGtype, the minimum value permitted.java.lang.StringgetName()Gets the name of this option.java.util.Map<DiscordLocale,java.lang.String>getNameLocalizations()Gets the name localizations for this option.java.util.List<SlashCommandOption>getOptions()If this option is a subcommand or subcommand group type, this nested options will be the parameters.SlashCommandOptionTypegetType()Gets the type of this option.booleanisAutocompletable()Checks whether this option can be autocompleted.booleanisRequired()Checks whether this option is required.
-
-
-
Method Detail
-
getType
SlashCommandOptionType getType()
Gets the type of this option.- Returns:
- The type.
-
getName
java.lang.String getName()
Gets the name of this option.- Returns:
- The name of this option.
-
getNameLocalizations
java.util.Map<DiscordLocale,java.lang.String> getNameLocalizations()
Gets the name localizations for this option.- Returns:
- The name localizations for this option.
-
getDescription
java.lang.String getDescription()
Gets the description of this option.- Returns:
- The description of this option.
-
getDescriptionLocalizations
java.util.Map<DiscordLocale,java.lang.String> getDescriptionLocalizations()
Gets the description localizations for this option.- Returns:
- The description localizations for this option.
-
isRequired
boolean isRequired()
Checks whether this option is required.- Returns:
- Whether this option is required.
-
isAutocompletable
boolean isAutocompletable()
Checks whether this option can be autocompleted.- Returns:
- Whether this option can be autocompleted.
-
getChoices
java.util.List<SlashCommandOptionChoice> getChoices()
Gets a list with all choices for this option.If this option has any choices, they are the only valid values for a user to pick.
- Returns:
- A list with all choices for this option.
-
getOptions
java.util.List<SlashCommandOption> getOptions()
If this option is a subcommand or subcommand group type, this nested options will be the parameters.- Returns:
- A list with the nested options.
-
getChannelTypes
java.util.Set<ChannelType> getChannelTypes()
If the option is of typeSlashCommandOptionType.CHANNEL, the channels shown will be restricted to these types.- Returns:
- A set with the channel types that are shown.
-
getLongMinValue
java.util.Optional<java.lang.Long> getLongMinValue()
If the option is anSlashCommandOptionType.LONGtype, the minimum value permitted.- Returns:
- The minimum value permitted.
-
getLongMaxValue
java.util.Optional<java.lang.Long> getLongMaxValue()
If the option is anSlashCommandOptionType.LONGtype, the maximum value permitted.- Returns:
- The maximum value permitted.
-
getDecimalMinValue
java.util.Optional<java.lang.Double> getDecimalMinValue()
If the option is anSlashCommandOptionType.DECIMALtype, the minimum value permitted.- Returns:
- The minimum value permitted.
-
getDecimalMaxValue
java.util.Optional<java.lang.Double> getDecimalMaxValue()
If the option is anSlashCommandOptionType.DECIMALtype, the maximum value permitted.- Returns:
- The maximum value permitted.
-
create
static SlashCommandOption create(SlashCommandOptionType type, java.lang.String name, java.lang.String description, boolean required)
Create a new slash command option to be used with a slash command builder. This is a convenience method.- Parameters:
type- The type of the option.name- The name of the option.description- The description of the option.required- Whether this option is required.- Returns:
- The new slash command option builder.
-
create
static SlashCommandOption create(SlashCommandOptionType type, java.lang.String name, java.lang.String description)
Create a new slash command option to be used with a slash command builder. This is a convenience method.- Parameters:
type- The type of the option.name- The name of the option.description- The description of the option.- Returns:
- The new slash command option builder.
-
createWithOptions
static SlashCommandOption createWithOptions(SlashCommandOptionType type, java.lang.String name, java.lang.String description, SlashCommandOptionBuilder... options)
Create a new subcommand or subcommand group to be used with a slash command builder. This is a convenience method.- Parameters:
type- The type of the option. Must be either SUBCOMMAND or SUBCOMMAND_GROUP.name- The name of the option.description- The description of the option.options- The options of this subcommand or subcommand group.- Returns:
- The new slash command option builder.
-
createWithOptions
static SlashCommandOption createWithOptions(SlashCommandOptionType type, java.lang.String name, java.lang.String description, java.util.List<SlashCommandOption> options)
Create a new subcommand or subcommand group to be used with a slash command builder. This is a convenience method.- Parameters:
type- The type of the option. Must be either SUBCOMMAND or SUBCOMMAND_GROUP.name- The name of the option.description- The description of the option.options- The options of this subcommand or subcommand group.- Returns:
- The new slash command option builder.
-
createWithChoices
static SlashCommandOption createWithChoices(SlashCommandOptionType type, java.lang.String name, java.lang.String description, boolean required, SlashCommandOptionChoiceBuilder... choices)
Create a new slash command option to be used with a slash command builder. This is a convenience method.- Parameters:
type- The type of the option.name- The name of the option.description- The description of the option.required- Whether this option is required.choices- The choices of the option.- Returns:
- The new slash command option builder.
-
createWithChoices
static SlashCommandOption createWithChoices(SlashCommandOptionType type, java.lang.String name, java.lang.String description, boolean required, java.util.List<SlashCommandOptionChoice> choices)
Create a new slash command option to be used with a slash command builder. This is a convenience method.- Parameters:
type- The type of the option.name- The name of the option.description- The description of the option.required- Whether this option is required.choices- The choices of the option.- Returns:
- The new slash command option builder.
-
createChannelOption
static SlashCommandOption createChannelOption(java.lang.String name, java.lang.String description, boolean required, java.util.Collection<ChannelType> channelTypes)
Create a new slash command option to be used with a slash command builder. This is a convenience method.- Parameters:
name- The name of the option.description- The description of the option.required- Whether this option is required.channelTypes- Channel types that are shown.- Returns:
- The new slash command option builder.
-
createDecimalOption
static SlashCommandOption createDecimalOption(java.lang.String name, java.lang.String description, boolean required)
Create a newSlashCommandOptionType.DECIMALslash command option to be used with a slash command builder. This is a convenience method.- Parameters:
name- The name of the option.description- The description of the option.required- Whether this option is required- Returns:
- The new slash command option builder.
-
createDecimalOption
static SlashCommandOption createDecimalOption(java.lang.String name, java.lang.String description, boolean required, boolean autocomplete)
Create a newSlashCommandOptionType.DECIMALslash command option to be used with a slash command builder. This is a convenience method.- Parameters:
name- The name of the option.description- The description of the option.required- Whether this option is requiredautocomplete- Whether this option can be autocompleted- Returns:
- The new slash command option builder.
-
createDecimalOption
static SlashCommandOption createDecimalOption(java.lang.String name, java.lang.String description, boolean required, double minValue, double maxValue)
Create a newSlashCommandOptionType.DECIMALslash command option to be used with a slash command builder. This is a convenience method.- Parameters:
name- The name of the option.description- The description of the option.required- Whether this option is requiredminValue- The minimum value permitted.maxValue- The maximum value permitted.- Returns:
- The new slash command option builder.
-
createAttachmentOption
static SlashCommandOption createAttachmentOption(java.lang.String name, java.lang.String description, boolean required)
Create a newSlashCommandOptionType.ATTACHMENTslash command option to be used with a slash command builder. This is a convenience method.- Parameters:
name- The name of the option.description- The description of the option.required- Whether this option is required.- Returns:
- The new slash command option builder.
-
createLongOption
static SlashCommandOption createLongOption(java.lang.String name, java.lang.String description, boolean required)
Create a newSlashCommandOptionType.LONGslash command option to be used with a slash command builder. This is a convenience method.- Parameters:
name- The name of the option.description- The description of the option.required- Whether this option is required- Returns:
- The new slash command option builder.
-
createLongOption
static SlashCommandOption createLongOption(java.lang.String name, java.lang.String description, boolean required, long minValue, long maxValue)
Create a newSlashCommandOptionType.LONGslash command option to be used with a slash command builder. This is a convenience method.- Parameters:
name- The name of the option.description- The description of the option.required- Whether this option is requiredminValue- The minimum value permitted.maxValue- The maximum value permitted.- Returns:
- The new slash command option builder.
-
createLongOption
static SlashCommandOption createLongOption(java.lang.String name, java.lang.String description, boolean required, boolean autocomplete)
Create a newSlashCommandOptionType.LONGslash command option to be used with a slash command builder. This is a convenience method.- Parameters:
name- The name of the option.description- The description of the option.required- Whether this option is requiredautocomplete- Whether this option can be autocompleted- Returns:
- The new slash command option builder.
-
createStringOption
static SlashCommandOption createStringOption(java.lang.String name, java.lang.String description, boolean required)
Create a newSlashCommandOptionType.STRINGslash command option to be used with a slash command builder. This is a convenience method.- Parameters:
name- The name of the option.description- The description of the option.required- Whether this option is required- Returns:
- The new slash command option builder.
-
createStringOption
static SlashCommandOption createStringOption(java.lang.String name, java.lang.String description, boolean required, boolean autocomplete)
Create a newSlashCommandOptionType.STRINGslash command option to be used with a slash command builder. This is a convenience method.- Parameters:
name- The name of the option.description- The description of the option.required- Whether this option is requiredautocomplete- Whether this option can be autocompleted- Returns:
- The new slash command option builder.
-
createRoleOption
static SlashCommandOption createRoleOption(java.lang.String name, java.lang.String description, boolean required)
Create a newSlashCommandOptionType.ROLEslash command option to be used with a slash command builder. This is a convenience method.- Parameters:
name- The name of the option.description- The description of the option.required- Whether this option is required- Returns:
- The new slash command option builder.
-
createMentionableOption
static SlashCommandOption createMentionableOption(java.lang.String name, java.lang.String description, boolean required)
Create a newSlashCommandOptionType.MENTIONABLEslash command option to be used with a slash command builder. This is a convenience method.- Parameters:
name- The name of the option.description- The description of the option.required- Whether this option is required- Returns:
- The new slash command option builder.
-
createUserOption
static SlashCommandOption createUserOption(java.lang.String name, java.lang.String description, boolean required)
Create a newSlashCommandOptionType.USERslash command option to be used with a slash command builder. This is a convenience method.- Parameters:
name- The name of the option.description- The description of the option.required- Whether this option is required- Returns:
- The new slash command option builder.
-
createBooleanOption
static SlashCommandOption createBooleanOption(java.lang.String name, java.lang.String description, boolean required)
Create a newSlashCommandOptionType.BOOLEANslash command option to be used with a slash command builder. This is a convenience method.- Parameters:
name- The name of the option.description- The description of the option.required- Whether this option is required- Returns:
- The new slash command option builder.
-
-