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 Default 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 SlashCommandOptioncreateStringOption(java.lang.String name, java.lang.String description, boolean required, long minLength, long maxLength)Create a newSlashCommandOptionType.STRINGslash command option to be used with a slash command builder.static SlashCommandOptioncreateSubcommand(java.lang.String name, java.lang.String description)Create a new subcommand option to be used with a slash command builder.static SlashCommandOptioncreateSubcommand(java.lang.String name, java.lang.String description, java.util.List<SlashCommandOption> options)Create a new subcommand option with options to be used with a slash command builder.static SlashCommandOptioncreateSubcommandGroup(java.lang.String name, java.lang.String description, java.util.List<SlashCommandOption> options)Create a new subcommand group 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 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.util.Optional<java.lang.Long>getMaxLength()If the option is anSlashCommandOptionType.STRINGtype, the maximum allowed length.java.util.Optional<java.lang.Long>getMinLength()If the option is anSlashCommandOptionType.STRINGtype, the minimum allowed length.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.default booleanisSubcommandOrGroup()Gets whether this slash command option is a subcommand or subcommand group.
-
-
-
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.
-
isSubcommandOrGroup
default boolean isSubcommandOrGroup()
Gets whether this slash command option is a subcommand or subcommand group.- Returns:
- Whether this slash command option is a subcommand or subcommand group.
-
getChoices
java.util.List<SlashCommandOptionChoice> getChoices()
Gets all choices for this option.If this option has any choices, they are the only valid values for a user to pick.
- Returns:
- 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:
- 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:
- 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.
-
getMinLength
java.util.Optional<java.lang.Long> getMinLength()
If the option is anSlashCommandOptionType.STRINGtype, the minimum allowed length.- Returns:
- The minimum allowed length.
-
getMaxLength
java.util.Optional<java.lang.Long> getMaxLength()
If the option is anSlashCommandOptionType.STRINGtype, the maximum allowed length.- Returns:
- The maximum allowed length.
-
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:
- A new slash command option instance.
-
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:
- A new slash command option instance.
-
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:
- A new slash command option instance.
-
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:
- A new slash command option instance.
-
createSubcommandGroup
static SlashCommandOption createSubcommandGroup(java.lang.String name, java.lang.String description, java.util.List<SlashCommandOption> options)
Create a new subcommand group option to be used with a slash command builder. This is a convenience method.- Parameters:
name- The name of the subcommand group.description- The description of the subcommand group.options- The sub command options of this subcommand group.- Returns:
- A new slash command option instance.
-
createSubcommand
static SlashCommandOption createSubcommand(java.lang.String name, java.lang.String description)
Create a new subcommand option to be used with a slash command builder. This is a convenience method.- Parameters:
name- The name of the subcommand.description- The description of the subcommand.- Returns:
- A new slash command option instance.
-
createSubcommand
static SlashCommandOption createSubcommand(java.lang.String name, java.lang.String description, java.util.List<SlashCommandOption> options)
Create a new subcommand option with options to be used with a slash command builder. This is a convenience method.- Parameters:
name- The name of the subcommand.description- The description of the subcommand.options- The options of this subcommand.- Returns:
- A new slash command option instance.
-
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:
- A new slash command option instance.
-
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:
- A new slash command option instance.
-
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:
- A new slash command option instance.
-
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:
- A new slash command option instance.
-
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:
- A new slash command option instance.
-
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:
- A new slash command option instance.
-
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:
- A new slash command option instance.
-
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:
- A new slash command option instance.
-
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:
- A new slash command option instance.
-
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:
- A new slash command option instance.
-
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:
- A new slash command option instance.
-
createStringOption
static SlashCommandOption createStringOption(java.lang.String name, java.lang.String description, boolean required, long minLength, long maxLength)
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 requiredminLength- The minimum allowed length.maxLength- The maximum allowed length.- Returns:
- A new slash command option instance.
-
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:
- A new slash command option instance.
-
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:
- A new slash command option instance.
-
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:
- A new slash command option instance.
-
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:
- A new slash command option instance.
-
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:
- A new slash command option instance.
-
-