Package org.javacord.api.interaction
Interface SlashCommandInteractionOptionsProvider
-
- All Known Subinterfaces:
AutocompleteInteraction,SlashCommandInteraction,SlashCommandInteractionOption
public interface SlashCommandInteractionOptionsProviderInternal interface that offers a few option related convenience methods. Outsourced to prevent code duplication.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default java.util.Optional<Attachment>getOptionAttachmentValueByIndex(int index)Gets the attachment value of an option at the specified index.default java.util.Optional<Attachment>getOptionAttachmentValueByName(java.lang.String name)Gets the attachment value of an option having the specified name.default java.util.Optional<java.lang.Boolean>getOptionBooleanValueByIndex(int index)Gets the boolean value of an option at the specified index.default java.util.Optional<java.lang.Boolean>getOptionBooleanValueByName(java.lang.String name)Gets the boolean value of an option having the specified name.default java.util.Optional<SlashCommandInteractionOption>getOptionByIndex(int index)Gets the option at the specified index, if present.default java.util.Optional<SlashCommandInteractionOption>getOptionByName(java.lang.String name)Get an option having the specified name.default java.util.Optional<ServerChannel>getOptionChannelValueByIndex(int index)Gets the channel value of an option at the specified index.default java.util.Optional<ServerChannel>getOptionChannelValueByName(java.lang.String name)Gets the channel value of an option having the specified name.default java.util.Optional<java.lang.Double>getOptionDecimalValueByIndex(int index)Gets the double value of an option at the specified index.default java.util.Optional<java.lang.Double>getOptionDecimalValueByName(java.lang.String name)Gets the double value of an option having the specified name.default java.util.Optional<java.lang.Long>getOptionLongValueByIndex(int index)Gets the long value of an option at the specified index.default java.util.Optional<java.lang.Long>getOptionLongValueByName(java.lang.String name)Gets the long value of an option having the specified name.default java.util.Optional<Mentionable>getOptionMentionableValueByIndex(int index)Gets the mentionable value of an option at the specified index which may be a user, channel or role.default java.util.Optional<Mentionable>getOptionMentionableValueByName(java.lang.String name)Gets the mentionable value of an option having the specified name which may be a user, channel or role.default java.util.Optional<Role>getOptionRoleValueByIndex(int index)Gets the role value of an option at the specified index.default java.util.Optional<Role>getOptionRoleValueByName(java.lang.String name)Gets the role value of an option having the specified name.java.util.List<SlashCommandInteractionOption>getOptions()Gets a list with the params and values from the user, or, if this command contains subcommands and/or subcommand groups, a list of subcommands and subcommand groups.default java.util.Optional<java.lang.String>getOptionStringRepresentationValueByIndex(int index)Gets the string representation value of an option at the specified index.default java.util.Optional<java.lang.String>getOptionStringRepresentationValueByName(java.lang.String name)Gets the string representation value of an option having the specified name.default java.util.Optional<java.lang.String>getOptionStringValueByIndex(int index)Gets the string value of an option at the specified index.default java.util.Optional<java.lang.String>getOptionStringValueByName(java.lang.String name)Gets the string value of an option having the specified name.default java.util.Optional<User>getOptionUserValueByIndex(int index)Gets the user value of an option at the specified index.default java.util.Optional<User>getOptionUserValueByName(java.lang.String name)Gets the user value of an option having the specified name.default java.util.Optional<java.util.concurrent.CompletableFuture<Mentionable>>requestOptionMentionableValueByIndex(int index)Gets the mentionable value of an option at the specified index which may be a user, channel or role.default java.util.Optional<java.util.concurrent.CompletableFuture<Mentionable>>requestOptionMentionableValueByName(java.lang.String name)Gets the mentionable value of an option having the specified name which may be a user, channel or role.default java.util.Optional<java.util.concurrent.CompletableFuture<User>>requestOptionUserValueByIndex(int index)Gets the user value of an option at the specified index.default java.util.Optional<java.util.concurrent.CompletableFuture<User>>requestOptionUserValueByName(java.lang.String name)Gets the user value of an option having the specified name.
-
-
-
Method Detail
-
getOptions
java.util.List<SlashCommandInteractionOption> getOptions()
Gets a list with the params and values from the user, or, if this command contains subcommands and/or subcommand groups, a list of subcommands and subcommand groups.- Returns:
- A list with the params and values from the user.
-
getOptionByName
default java.util.Optional<SlashCommandInteractionOption> getOptionByName(java.lang.String name)
Get an option having the specified name.- Parameters:
name- The name of the option to search for.- Returns:
- The option with the specified name, if found; an empty Optional otherwise
-
getOptionStringRepresentationValueByName
default java.util.Optional<java.lang.String> getOptionStringRepresentationValueByName(java.lang.String name)
Gets the string representation value of an option having the specified name.- Parameters:
name- The name of the option to search for.- Returns:
- An Optional with the string value of such an option if it exists; an empty Optional otherwise
-
getOptionStringValueByName
default java.util.Optional<java.lang.String> getOptionStringValueByName(java.lang.String name)
Gets the string value of an option having the specified name.- Parameters:
name- The name of the option to search for.- Returns:
- An Optional with the string value of such an option if it exists; an empty Optional otherwise
-
getOptionLongValueByName
default java.util.Optional<java.lang.Long> getOptionLongValueByName(java.lang.String name)
Gets the long value of an option having the specified name. This will be present if the option is of typeSlashCommandOptionType.LONG.- Parameters:
name- The name of the option to search for.- Returns:
- An Optional with the long value of such an option if it exists; an empty Optional otherwise
-
getOptionBooleanValueByName
default java.util.Optional<java.lang.Boolean> getOptionBooleanValueByName(java.lang.String name)
Gets the boolean value of an option having the specified name.- Parameters:
name- The name of the option to search for.- Returns:
- An Optional with the boolean value of such an option if it exists; an empty Optional otherwise
-
getOptionUserValueByName
default java.util.Optional<User> getOptionUserValueByName(java.lang.String name)
Gets the user value of an option having the specified name. Note: This method only respects cached users. To fetch the user from Discord if the user is not cached, userequestOptionUserValueByName().- Parameters:
name- The name of the option to search for.- Returns:
- An Optional with the user value of such an option if it exists; an empty Optional otherwise
-
requestOptionUserValueByName
default java.util.Optional<java.util.concurrent.CompletableFuture<User>> requestOptionUserValueByName(java.lang.String name)
Gets the user value of an option having the specified name.- Parameters:
name- The name of the option to search for.- Returns:
- An Optional with the user value of such an option if it exists; an empty Optional otherwise
-
getOptionChannelValueByName
default java.util.Optional<ServerChannel> getOptionChannelValueByName(java.lang.String name)
Gets the channel value of an option having the specified name.- Parameters:
name- The name of the option to search for.- Returns:
- An Optional with the channel value of such an option if it exists; an empty Optional otherwise
-
getOptionRoleValueByName
default java.util.Optional<Role> getOptionRoleValueByName(java.lang.String name)
Gets the role value of an option having the specified name.- Parameters:
name- The name of the option to search for.- Returns:
- An Optional with the role value of such an option if it exists; an empty Optional otherwise
-
getOptionMentionableValueByName
default java.util.Optional<Mentionable> getOptionMentionableValueByName(java.lang.String name)
Gets the mentionable value of an option having the specified name which may be a user, channel or role. Note: This method only respects cached users if the ID of the Mentionable belongs to a user. To fetch the user from Discord if the user is not cached, userequestOptionMentionableValueByName().- Parameters:
name- The name of the option to search for.- Returns:
- An Optional with the mentionable value of such an option if it exists; an empty Optional otherwise
-
requestOptionMentionableValueByName
default java.util.Optional<java.util.concurrent.CompletableFuture<Mentionable>> requestOptionMentionableValueByName(java.lang.String name)
Gets the mentionable value of an option having the specified name which may be a user, channel or role.- Parameters:
name- The name of the option to search for.- Returns:
- An Optional with the mentionable value of such an option if it exists; an empty Optional otherwise
-
getOptionDecimalValueByName
default java.util.Optional<java.lang.Double> getOptionDecimalValueByName(java.lang.String name)
Gets the double value of an option having the specified name.- Parameters:
name- The name of the option to search for.- Returns:
- An Optional with the double value of such an option if it exists; an empty Optional otherwise
-
getOptionAttachmentValueByName
default java.util.Optional<Attachment> getOptionAttachmentValueByName(java.lang.String name)
Gets the attachment value of an option having the specified name.- Parameters:
name- The name of the option to search for.- Returns:
- An Optional with the attachment value of such an option if it exists; an empty Optional otherwise
-
getOptionByIndex
default java.util.Optional<SlashCommandInteractionOption> getOptionByIndex(int index)
Gets the option at the specified index, if present.- Parameters:
index- The index of the option to search for.- Returns:
- The option with the specified index, if found; an empty Optional otherwise
-
getOptionStringRepresentationValueByIndex
default java.util.Optional<java.lang.String> getOptionStringRepresentationValueByIndex(int index)
Gets the string representation value of an option at the specified index.- Parameters:
index- The index of the option to search for.- Returns:
- An Optional with the string value of such an option if it exists; an empty Optional otherwise
-
getOptionStringValueByIndex
default java.util.Optional<java.lang.String> getOptionStringValueByIndex(int index)
Gets the string value of an option at the specified index.- Parameters:
index- The index of the option to search for.- Returns:
- An Optional with the string value of such an option if it exists; an empty Optional otherwise
-
getOptionLongValueByIndex
default java.util.Optional<java.lang.Long> getOptionLongValueByIndex(int index)
Gets the long value of an option at the specified index. This will be present if the option is of typeSlashCommandOptionType.LONG.- Parameters:
index- The index of the option to search for.- Returns:
- An Optional with the long value of such an option if it exists; an empty Optional otherwise
-
getOptionBooleanValueByIndex
default java.util.Optional<java.lang.Boolean> getOptionBooleanValueByIndex(int index)
Gets the boolean value of an option at the specified index.- Parameters:
index- The index of the option to search for.- Returns:
- An Optional with the boolean value of such an option if it exists; an empty Optional otherwise
-
getOptionUserValueByIndex
default java.util.Optional<User> getOptionUserValueByIndex(int index)
Gets the user value of an option at the specified index. Note: This method only respects cached users. To fetch the user from Discord if the user is not cached, userequestOptionUserValueByIndex().- Parameters:
index- The index of the option to search for.- Returns:
- An Optional with the user value of such an option if it exists; an empty Optional otherwise
-
requestOptionUserValueByIndex
default java.util.Optional<java.util.concurrent.CompletableFuture<User>> requestOptionUserValueByIndex(int index)
Gets the user value of an option at the specified index.- Parameters:
index- The index of the option to search for.- Returns:
- An Optional with the user value of such an option if it exists; an empty Optional otherwise
-
getOptionChannelValueByIndex
default java.util.Optional<ServerChannel> getOptionChannelValueByIndex(int index)
Gets the channel value of an option at the specified index.- Parameters:
index- The index of the option to search for.- Returns:
- An Optional with the channel value of such an option if it exists; an empty Optional otherwise
-
getOptionRoleValueByIndex
default java.util.Optional<Role> getOptionRoleValueByIndex(int index)
Gets the role value of an option at the specified index.- Parameters:
index- The index of the option to search for.- Returns:
- An Optional with the role value of such an option if it exists; an empty Optional otherwise
-
getOptionMentionableValueByIndex
default java.util.Optional<Mentionable> getOptionMentionableValueByIndex(int index)
Gets the mentionable value of an option at the specified index which may be a user, channel or role. Note: This method only respects cached users if the ID of the Mentionable belongs to a user. To fetch the user from Discord if the user is not cached, userequestOptionMentionableValueByIndex().- Parameters:
index- The index of the option to search for.- Returns:
- An Optional with the mentionable value of such an option if it exists; an empty Optional otherwise
-
requestOptionMentionableValueByIndex
default java.util.Optional<java.util.concurrent.CompletableFuture<Mentionable>> requestOptionMentionableValueByIndex(int index)
Gets the mentionable value of an option at the specified index which may be a user, channel or role.- Parameters:
index- The index of the option to search for.- Returns:
- An Optional with the mentionable value of such an option if it exists; an empty Optional otherwise
-
getOptionDecimalValueByIndex
default java.util.Optional<java.lang.Double> getOptionDecimalValueByIndex(int index)
Gets the double value of an option at the specified index.- Parameters:
index- The index of the option to search for.- Returns:
- An Optional with the double value of such an option if it exists; an empty Optional otherwise
-
getOptionAttachmentValueByIndex
default java.util.Optional<Attachment> getOptionAttachmentValueByIndex(int index)
Gets the attachment value of an option at the specified index.- Parameters:
index- The index of the option to search for.- Returns:
- An Optional with the attachment value of such an option if it exists; an empty Optional otherwise
-
-