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>getArgumentAttachmentValueByIndex(int index)Gets the attachment value of an argument at the specified index.default java.util.Optional<Attachment>getArgumentAttachmentValueByName(java.lang.String name)Gets the attachment value of an argument having the specified name.default java.util.Optional<java.lang.Boolean>getArgumentBooleanValueByIndex(int index)Gets the boolean value of an argument at the specified index.default java.util.Optional<java.lang.Boolean>getArgumentBooleanValueByName(java.lang.String name)Gets the boolean value of an argument having the specified name.default java.util.Optional<SlashCommandInteractionOption>getArgumentByIndex(int index)Gets the argument at the specified index, if present.default java.util.Optional<SlashCommandInteractionOption>getArgumentByName(java.lang.String name)Get an argument having the specified name.default java.util.Optional<ServerChannel>getArgumentChannelValueByIndex(int index)Gets the channel value of an argument at the specified index.default java.util.Optional<ServerChannel>getArgumentChannelValueByName(java.lang.String name)Gets the channel value of an argument having the specified name.default java.util.Optional<java.lang.Double>getArgumentDecimalValueByIndex(int index)Gets the double value of an argument at the specified index.default java.util.Optional<java.lang.Double>getArgumentDecimalValueByName(java.lang.String name)Gets the double value of an argument having the specified name.default java.util.Optional<java.lang.Long>getArgumentLongValueByIndex(int index)Gets the long value of an argument at the specified index.default java.util.Optional<java.lang.Long>getArgumentLongValueByName(java.lang.String name)Gets the long value of an argument having the specified name.default java.util.Optional<Mentionable>getArgumentMentionableValueByIndex(int index)Gets the mentionable value of an argument at the specified index which may be a user, channel or role.default java.util.Optional<Mentionable>getArgumentMentionableValueByName(java.lang.String name)Gets the mentionable value of an argument having the specified name which may be a user, channel or role.default java.util.Optional<Role>getArgumentRoleValueByIndex(int index)Gets the role value of an argument at the specified index.default java.util.Optional<Role>getArgumentRoleValueByName(java.lang.String name)Gets the role value of an argument having the specified name.java.util.List<SlashCommandInteractionOption>getArguments()Gets the arguments of this slash command if there are any.default java.util.Optional<java.lang.String>getArgumentStringRepresentationValueByIndex(int index)Gets the string representation value of an argument at the specified index.default java.util.Optional<java.lang.String>getArgumentStringRepresentationValueByName(java.lang.String name)Gets the string representation value of an argument having the specified name.default java.util.Optional<java.lang.String>getArgumentStringValueByIndex(int index)Gets the string value of an argument at the specified index.default java.util.Optional<java.lang.String>getArgumentStringValueByName(java.lang.String name)Gets the string value of an argument having the specified name.default java.util.Optional<User>getArgumentUserValueByIndex(int index)Gets the user value of an argument at the specified index.default java.util.Optional<User>getArgumentUserValueByName(java.lang.String name)Gets the user value of an argument 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.java.util.List<SlashCommandInteractionOption>getOptions()Gets 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.util.concurrent.CompletableFuture<Mentionable>>requestArgumentMentionableValueByIndex(int index)Gets the mentionable value of an argument at the specified index which may be a user, channel or role.default java.util.Optional<java.util.concurrent.CompletableFuture<Mentionable>>requestArgumentMentionableValueByName(java.lang.String name)Gets the mentionable value of an argument having the specified name which may be a user, channel or role.default java.util.Optional<java.util.concurrent.CompletableFuture<User>>requestArgumentUserValueByIndex(int index)Gets the user value of an argument at the specified index.default java.util.Optional<java.util.concurrent.CompletableFuture<User>>requestArgumentUserValueByName(java.lang.String name)Gets the user value of an argument having the specified name.
-
-
-
Method Detail
-
getOptions
java.util.List<SlashCommandInteractionOption> getOptions()
Gets 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:
- The params and values from the user.
-
getArguments
java.util.List<SlashCommandInteractionOption> getArguments()
Gets the arguments of this slash command if there are any.This is a shorthand method to avoid checking for Subcommmands or SubcommandGroups to get the slash command arguments.
- Returns:
- The argument options.
-
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
-
getArgumentByName
default java.util.Optional<SlashCommandInteractionOption> getArgumentByName(java.lang.String name)
Get an argument having the specified name.- Parameters:
name- The name of the argument to search for.- Returns:
- The argument with the specified name, if found; an empty Optional otherwise
-
getArgumentStringRepresentationValueByName
default java.util.Optional<java.lang.String> getArgumentStringRepresentationValueByName(java.lang.String name)
Gets the string representation value of an argument having the specified name.- Parameters:
name- The name of the argument to search for.- Returns:
- An Optional with the string representation value of such an argument, if the argument exists; an empty Optional otherwise
-
getArgumentStringValueByName
default java.util.Optional<java.lang.String> getArgumentStringValueByName(java.lang.String name)
Gets the string value of an argument having the specified name.- Parameters:
name- The name of the argument to search for.- Returns:
- An Optional with the string value of such an argument if it exists; an empty Optional otherwise
-
getArgumentLongValueByName
default java.util.Optional<java.lang.Long> getArgumentLongValueByName(java.lang.String name)
Gets the long value of an argument having the specified name. This will be present if the argument is of typeSlashCommandOptionType.LONG.- Parameters:
name- The name of the argument to search for.- Returns:
- An Optional with the long value of such an argument if it exists; an empty Optional otherwise
-
getArgumentBooleanValueByName
default java.util.Optional<java.lang.Boolean> getArgumentBooleanValueByName(java.lang.String name)
Gets the boolean value of an argument having the specified name.- Parameters:
name- The name of the argument to search for.- Returns:
- An Optional with the boolean value of such an argument if it exists; an empty Optional otherwise
-
getArgumentUserValueByName
default java.util.Optional<User> getArgumentUserValueByName(java.lang.String name)
Gets the user value of an argument having the specified name. Note: This method only respects cached users. To fetch the user from Discord if the user is not cached, userequestArgumentUserValueByName().- Parameters:
name- The name of the argument to search for.- Returns:
- An Optional with the user value of such an argument if it exists; an empty Optional otherwise
-
requestArgumentUserValueByName
default java.util.Optional<java.util.concurrent.CompletableFuture<User>> requestArgumentUserValueByName(java.lang.String name)
Gets the user value of an argument having the specified name.- Parameters:
name- The name of the argument to search for.- Returns:
- An Optional with the user value of such an argument if it exists; an empty Optional otherwise
-
getArgumentChannelValueByName
default java.util.Optional<ServerChannel> getArgumentChannelValueByName(java.lang.String name)
Gets the channel value of an argument having the specified name.- Parameters:
name- The name of the argument to search for.- Returns:
- An Optional with the channel value of such an argument if it exists; an empty Optional otherwise
-
getArgumentRoleValueByName
default java.util.Optional<Role> getArgumentRoleValueByName(java.lang.String name)
Gets the role value of an argument having the specified name.- Parameters:
name- The name of the argument to search for.- Returns:
- An Optional with the role value of such an argument if it exists; an empty Optional otherwise
-
getArgumentMentionableValueByName
default java.util.Optional<Mentionable> getArgumentMentionableValueByName(java.lang.String name)
Gets the mentionable value of an argument 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, userequestArgumentMentionableValueByName().- Parameters:
name- The name of the argument to search for.- Returns:
- An Optional with the mentionable value of such an argument if it exists; an empty Optional otherwise
-
requestArgumentMentionableValueByName
default java.util.Optional<java.util.concurrent.CompletableFuture<Mentionable>> requestArgumentMentionableValueByName(java.lang.String name)
Gets the mentionable value of an argument having the specified name which may be a user, channel or role.- Parameters:
name- The name of the argument to search for.- Returns:
- An Optional with the mentionable value of such an argument if it exists; an empty Optional otherwise
-
getArgumentDecimalValueByName
default java.util.Optional<java.lang.Double> getArgumentDecimalValueByName(java.lang.String name)
Gets the double value of an argument having the specified name.- Parameters:
name- The name of the argument to search for.- Returns:
- An Optional with the double value of such an argument if it exists; an empty Optional otherwise
-
getArgumentAttachmentValueByName
default java.util.Optional<Attachment> getArgumentAttachmentValueByName(java.lang.String name)
Gets the attachment value of an argument having the specified name.- Parameters:
name- The name of the argument to search for.- Returns:
- An Optional with the attachment value of such an argument 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
-
getArgumentByIndex
default java.util.Optional<SlashCommandInteractionOption> getArgumentByIndex(int index)
Gets the argument at the specified index, if present.- Parameters:
index- The index of the argument to search for.- Returns:
- The argument with the specified index, if found; an empty Optional otherwise
-
getArgumentStringRepresentationValueByIndex
default java.util.Optional<java.lang.String> getArgumentStringRepresentationValueByIndex(int index)
Gets the string representation value of an argument at the specified index.- Parameters:
index- The index of the argument to search for.- Returns:
- An Optional with the string representation value of such an argument, if the argument exists; an empty Optional otherwise
-
getArgumentStringValueByIndex
default java.util.Optional<java.lang.String> getArgumentStringValueByIndex(int index)
Gets the string value of an argument at the specified index.- Parameters:
index- The index of the argument to search for.- Returns:
- An Optional with the string value of such an argument if it exists; an empty Optional otherwise
-
getArgumentLongValueByIndex
default java.util.Optional<java.lang.Long> getArgumentLongValueByIndex(int index)
Gets the long value of an argument at the specified index. This will be present if the argument is of typeSlashCommandOptionType.LONG.- Parameters:
index- The index of the argument to search for.- Returns:
- An Optional with the long value of such an argument if it exists; an empty Optional otherwise
-
getArgumentBooleanValueByIndex
default java.util.Optional<java.lang.Boolean> getArgumentBooleanValueByIndex(int index)
Gets the boolean value of an argument at the specified index.- Parameters:
index- The index of the argument to search for.- Returns:
- An Optional with the boolean value of such an argument if it exists; an empty Optional otherwise
-
getArgumentUserValueByIndex
default java.util.Optional<User> getArgumentUserValueByIndex(int index)
Gets the user value of an argument at the specified index. Note: This method only respects cached users. To fetch the user from Discord if the user is not cached, userequestArgumentUserValueByIndex().- Parameters:
index- The index of the argument to search for.- Returns:
- An Optional with the user value of such an argument if it exists; an empty Optional otherwise
-
requestArgumentUserValueByIndex
default java.util.Optional<java.util.concurrent.CompletableFuture<User>> requestArgumentUserValueByIndex(int index)
Gets the user value of an argument at the specified index.- Parameters:
index- The index of the argument to search for.- Returns:
- An Optional with the user value of such an argument if it exists; an empty Optional otherwise
-
getArgumentChannelValueByIndex
default java.util.Optional<ServerChannel> getArgumentChannelValueByIndex(int index)
Gets the channel value of an argument at the specified index.- Parameters:
index- The index of the argument to search for.- Returns:
- An Optional with the channel value of such an argument if it exists; an empty Optional otherwise
-
getArgumentRoleValueByIndex
default java.util.Optional<Role> getArgumentRoleValueByIndex(int index)
Gets the role value of an argument at the specified index.- Parameters:
index- The index of the argument to search for.- Returns:
- An Optional with the role value of such an argument if it exists; an empty Optional otherwise
-
getArgumentMentionableValueByIndex
default java.util.Optional<Mentionable> getArgumentMentionableValueByIndex(int index)
Gets the mentionable value of an argument 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, userequestArgumentMentionableValueByIndex().- Parameters:
index- The index of the argument to search for.- Returns:
- An Optional with the mentionable value of such an argument if it exists; an empty Optional otherwise
-
requestArgumentMentionableValueByIndex
default java.util.Optional<java.util.concurrent.CompletableFuture<Mentionable>> requestArgumentMentionableValueByIndex(int index)
Gets the mentionable value of an argument at the specified index which may be a user, channel or role.- Parameters:
index- The index of the argument to search for.- Returns:
- An Optional with the mentionable value of such an argument if it exists; an empty Optional otherwise
-
getArgumentDecimalValueByIndex
default java.util.Optional<java.lang.Double> getArgumentDecimalValueByIndex(int index)
Gets the double value of an argument at the specified index.- Parameters:
index- The index of the argument to search for.- Returns:
- An Optional with the double value of such an argument if it exists; an empty Optional otherwise
-
getArgumentAttachmentValueByIndex
default java.util.Optional<Attachment> getArgumentAttachmentValueByIndex(int index)
Gets the attachment value of an argument at the specified index.- Parameters:
index- The index of the argument to search for.- Returns:
- An Optional with the attachment value of such an argument if it exists; an empty Optional otherwise
-
-