Package org.javacord.api.interaction
Class SlashCommandOptionBuilder
- java.lang.Object
-
- org.javacord.api.interaction.SlashCommandOptionBuilder
-
public class SlashCommandOptionBuilder extends java.lang.Object
-
-
Constructor Summary
Constructors Constructor Description SlashCommandOptionBuilder()Creates a new slash command option builder.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description SlashCommandOptionBuilderaddChannelType(ChannelType channelType)Adds a channel type to the slash command option.SlashCommandOptionBuilderaddChoice(java.lang.String name, int value)Adds an int choice for the slash command option.SlashCommandOptionBuilderaddChoice(java.lang.String name, java.lang.String value)Adds a string choice for the slash command option.SlashCommandOptionBuilderaddChoice(SlashCommandOptionChoice choice)Adds a choice for the slash command option.SlashCommandOptionBuilderaddDescriptionLocalization(DiscordLocale locale, java.lang.String localization)Adds a description localization for the given locale.SlashCommandOptionBuilderaddNameLocalization(DiscordLocale locale, java.lang.String localization)Adds a name localization for the given locale.SlashCommandOptionBuilderaddOption(SlashCommandOption option)Adds a slash command option to the slash command option.SlashCommandOptionbuild()Builds the slash command option.SlashCommandOptionBuildersetAutocompletable(boolean autocompletable)Sets if this option can be autocompleted.SlashCommandOptionBuildersetChannelTypes(java.util.Collection<ChannelType> channelTypes)Sets the channel types for the slash command option.SlashCommandOptionBuildersetChoices(java.util.List<SlashCommandOptionChoice> choices)Sets the choices of the slash command option.SlashCommandOptionBuildersetDecimalMaxValue(double decimalMaxValue)Sets the maximum value permitted for theSlashCommandOptionType.DECIMALslash command option.SlashCommandOptionBuildersetDecimalMinValue(double decimalMinValue)Sets the minimum value permitted for theSlashCommandOptionType.DECIMALslash command option.SlashCommandOptionBuildersetDescription(java.lang.String description)Sets the description of the slash command option.SlashCommandOptionBuildersetLongMaxValue(long longMaxValue)Sets the maximum value permitted for theSlashCommandOptionType.LONGslash command option.SlashCommandOptionBuildersetLongMinValue(long longMinValue)Sets the minimum value permitted for theSlashCommandOptionType.LONGslash command option.SlashCommandOptionBuildersetMaxLength(long maxLength)Sets theSlashCommandOptionType.STRINGmax length for the slash command option.SlashCommandOptionBuildersetMinLength(long minLength)Sets theSlashCommandOptionType.STRINGmin length for the slash command option.SlashCommandOptionBuildersetName(java.lang.String name)Sets the name of the slash command option.SlashCommandOptionBuildersetOptions(java.util.List<SlashCommandOption> options)Sets the slash commands for the slash command option.SlashCommandOptionBuildersetRequired(boolean required)Sets if the slash command option is required.SlashCommandOptionBuildersetType(SlashCommandOptionType type)Sets the type of the slash command option.
-
-
-
Method Detail
-
setType
public SlashCommandOptionBuilder setType(SlashCommandOptionType type)
Sets the type of the slash command option.- Parameters:
type- The type.- Returns:
- The current instance in order to chain call methods.
-
setName
public SlashCommandOptionBuilder setName(java.lang.String name)
Sets the name of the slash command option.- Parameters:
name- The name.- Returns:
- The current instance in order to chain call methods.
-
addNameLocalization
public SlashCommandOptionBuilder addNameLocalization(DiscordLocale locale, java.lang.String localization)
Adds a name localization for the given locale.- Parameters:
locale- The locale to add this localization for.localization- The option name localization.- Returns:
- The current instance in order to chain call methods.
-
setDescription
public SlashCommandOptionBuilder setDescription(java.lang.String description)
Sets the description of the slash command option.- Parameters:
description- The description.- Returns:
- The current instance in order to chain call methods.
-
addDescriptionLocalization
public SlashCommandOptionBuilder addDescriptionLocalization(DiscordLocale locale, java.lang.String localization)
Adds a description localization for the given locale.- Parameters:
locale- The locale to add this localization for.localization- The option description localization.- Returns:
- The current instance in order to chain call methods.
-
setRequired
public SlashCommandOptionBuilder setRequired(boolean required)
Sets if the slash command option is required.- Parameters:
required- Whether the option is required.- Returns:
- The current instance in order to chain call methods.
-
setAutocompletable
public SlashCommandOptionBuilder setAutocompletable(boolean autocompletable)
Sets if this option can be autocompleted.- Parameters:
autocompletable- Whether the option can be autocompleted.- Returns:
- The current instance in order to chain call methods.
-
addChoice
public SlashCommandOptionBuilder addChoice(SlashCommandOptionChoice choice)
Adds a choice for the slash command option.- Parameters:
choice- The choice.- Returns:
- The current instance in order to chain call methods.
-
addChoice
public SlashCommandOptionBuilder addChoice(java.lang.String name, java.lang.String value)
Adds a string choice for the slash command option.- Parameters:
name- The name of the choice.value- The value of the choice.- Returns:
- The current instance in order to chain call methods.
-
addChoice
public SlashCommandOptionBuilder addChoice(java.lang.String name, int value)
Adds an int choice for the slash command option.- Parameters:
name- The name of the choice.value- The value of the choice.- Returns:
- The current instance in order to chain call methods.
-
setChoices
public SlashCommandOptionBuilder setChoices(java.util.List<SlashCommandOptionChoice> choices)
Sets the choices of the slash command option.- Parameters:
choices- The choices.- Returns:
- The current instance in order to chain call methods.
-
addOption
public SlashCommandOptionBuilder addOption(SlashCommandOption option)
Adds a slash command option to the slash command option.- Parameters:
option- The option.- Returns:
- The current instance in order to chain call methods.
-
setOptions
public SlashCommandOptionBuilder setOptions(java.util.List<SlashCommandOption> options)
Sets the slash commands for the slash command option.- Parameters:
options- The options.- Returns:
- The current instance in order to chain call methods.
-
addChannelType
public SlashCommandOptionBuilder addChannelType(ChannelType channelType)
Adds a channel type to the slash command option.- Parameters:
channelType- The channel type.- Returns:
- The current instance in order to chain call methods.
-
setChannelTypes
public SlashCommandOptionBuilder setChannelTypes(java.util.Collection<ChannelType> channelTypes)
Sets the channel types for the slash command option.- Parameters:
channelTypes- The channel types.- Returns:
- The current instance in order to chain call methods.
-
setLongMinValue
public SlashCommandOptionBuilder setLongMinValue(long longMinValue)
Sets the minimum value permitted for theSlashCommandOptionType.LONGslash command option.- Parameters:
longMinValue- The minimum value permitted.- Returns:
- The current instance in order to chain call methods
-
setLongMaxValue
public SlashCommandOptionBuilder setLongMaxValue(long longMaxValue)
Sets the maximum value permitted for theSlashCommandOptionType.LONGslash command option.- Parameters:
longMaxValue- The maximum value permitted.- Returns:
- The current instance in order to chain call methods
-
setDecimalMinValue
public SlashCommandOptionBuilder setDecimalMinValue(double decimalMinValue)
Sets the minimum value permitted for theSlashCommandOptionType.DECIMALslash command option.- Parameters:
decimalMinValue- The minimum value permitted.- Returns:
- The current instance in order to chain call methods
-
setDecimalMaxValue
public SlashCommandOptionBuilder setDecimalMaxValue(double decimalMaxValue)
Sets the maximum value permitted for theSlashCommandOptionType.DECIMALslash command option.- Parameters:
decimalMaxValue- The maximum value permitted.- Returns:
- The current instance in order to chain call methods
-
setMinLength
public SlashCommandOptionBuilder setMinLength(long minLength)
Sets theSlashCommandOptionType.STRINGmin length for the slash command option.- Parameters:
minLength- The string min length.- Returns:
- The current instance in order to chain call methods
-
setMaxLength
public SlashCommandOptionBuilder setMaxLength(long maxLength)
Sets theSlashCommandOptionType.STRINGmax length for the slash command option.- Parameters:
maxLength- The string min length.- Returns:
- The current instance in order to chain call methods
-
build
public SlashCommandOption build()
Builds the slash command option.- Returns:
- The built option.
-
-