Interface SlashCommandInteractionOptionsProvider

    • Method Detail

      • getOptions

        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.
      • getFirstOption

        default Optional<SlashCommandInteractionOption> getFirstOption​()
        Get the first option, if present. Useful if you're working with a command that has only one option.
        Returns:
        The option at index 0, if present; an empty Optional otherwise
      • getFirstOptionStringValue

        default Optional<String> getFirstOptionStringValue​()
        Gets the string representation of the first option (if present).
        Returns:
        An Optional with the string value of such an option if it exists; an empty Optional otherwise
      • getFirstOptionIntValue

        default Optional<Integer> getFirstOptionIntValue​()
        Gets the integer value of the first option (if present).
        Returns:
        An Optional with the integer value of such an option if it exists; an empty Optional otherwise
      • getFirstOptionBooleanValue

        default Optional<Boolean> getFirstOptionBooleanValue​()
        Gets the boolean value of the first option (if present).
        Returns:
        An Optional with the boolean value of such an option if it exists; an empty Optional otherwise
      • getFirstOptionUserValue

        default Optional<User> getFirstOptionUserValue​()
        Gets the user value of the first option (if present). Note: This method only respects cached users. To fetch the user from Discord if the user is not cached, use requestFirstOptionUserValue().
        Returns:
        An Optional with the user value of such an option if it exists; an empty Optional otherwise
      • requestFirstOptionUserValue

        default Optional<CompletableFuture<User>> requestFirstOptionUserValue​()
        Gets the user value of the first option (if present).
        Returns:
        An Optional with the user value of such an option if it exists; an empty Optional otherwise
      • getFirstOptionChannelValue

        default Optional<ServerChannel> getFirstOptionChannelValue​()
        Gets the channel value of the first option (if present).
        Returns:
        An Optional with the channel value of such an option if it exists; an empty Optional otherwise
      • getFirstOptionRoleValue

        default Optional<Role> getFirstOptionRoleValue​()
        Gets the role value of the first option (if present).
        Returns:
        An Optional with the role value of such an option if it exists; an empty Optional otherwise
      • getFirstOptionMentionableValue

        default Optional<Mentionable> getFirstOptionMentionableValue​()
        Gets the mentionable value of the first option (if present) 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, use requestFirstOptionMentionableValue().
        Returns:
        An Optional with the mentionable value of such an option if it exists; an empty Optional otherwise
      • requestFirstOptionMentionableValue

        default Optional<CompletableFuture<Mentionable>> requestFirstOptionMentionableValue​()
        Gets the mentionable value of the first option (if present) which may be a user, channel or role.
        Returns:
        An Optional with the mentionable value of such an option if it exists; an empty Optional otherwise
      • getSecondOption

        default Optional<SlashCommandInteractionOption> getSecondOption​()
        Get the second option, if present. Useful if you're working with a command that has two options.
        Returns:
        The option at index 0, if present; an empty Optional otherwise
      • getSecondOptionStringValue

        default Optional<String> getSecondOptionStringValue​()
        Gets the string representation of the second option (if present).
        Returns:
        An Optional with the string value of such an option if it exists; an empty Optional otherwise
      • getSecondOptionIntValue

        default Optional<Integer> getSecondOptionIntValue​()
        Gets the integer value of the second option (if present).
        Returns:
        An Optional with the integer value of such an option if it exists; an empty Optional otherwise
      • getSecondOptionBooleanValue

        default Optional<Boolean> getSecondOptionBooleanValue​()
        Gets the boolean value of the second option (if present).
        Returns:
        An Optional with the boolean value of such an option if it exists; an empty Optional otherwise
      • getSecondOptionUserValue

        default Optional<User> getSecondOptionUserValue​()
        Gets the user value of the second option (if present). Note: This method only respects cached users. To fetch the user from Discord if the user is not cached, use requestSecondOptionUserValue().
        Returns:
        An Optional with the user value of such an option if it exists; an empty Optional otherwise
      • requestSecondOptionUserValue

        default Optional<CompletableFuture<User>> requestSecondOptionUserValue​()
        Gets the user value of the second option (if present).
        Returns:
        An Optional with the user value of such an option if it exists; an empty Optional otherwise
      • getSecondOptionChannelValue

        default Optional<ServerChannel> getSecondOptionChannelValue​()
        Gets the channel value of the second option (if present).
        Returns:
        An Optional with the channel value of such an option if it exists; an empty Optional otherwise
      • getSecondOptionRoleValue

        default Optional<Role> getSecondOptionRoleValue​()
        Gets the role value of the second option (if present).
        Returns:
        An Optional with the role value of such an option if it exists; an empty Optional otherwise
      • getSecondOptionMentionableValue

        default Optional<Mentionable> getSecondOptionMentionableValue​()
        Gets the mentionable value of the second option (if present) 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, use requestSecondOptionMentionableValue().
        Returns:
        An Optional with the mentionable value of such an option if it exists; an empty Optional otherwise
      • requestSecondOptionMentionableValue

        default Optional<CompletableFuture<Mentionable>> requestSecondOptionMentionableValue​()
        Gets the mentionable value of the second option (if present) which may be a user, channel or role.
        Returns:
        An Optional with the mentionable value of such an option if it exists; an empty Optional otherwise
      • getThirdOption

        default Optional<SlashCommandInteractionOption> getThirdOption​()
        Get the third option, if present. Useful if you're working with a command that has up to 3 options.
        Returns:
        The option at index 0, if present; an empty Optional otherwise
      • getThirdOptionStringValue

        default Optional<String> getThirdOptionStringValue​()
        Gets the string representation of the third option (if present).
        Returns:
        An Optional with the string value of such an option if it exists; an empty Optional otherwise
      • getThirdOptionIntValue

        default Optional<Integer> getThirdOptionIntValue​()
        Gets the integer value of the third option (if present).
        Returns:
        An Optional with the integer value of such an option if it exists; an empty Optional otherwise
      • getThirdOptionBooleanValue

        default Optional<Boolean> getThirdOptionBooleanValue​()
        Gets the boolean value of the third option (if present).
        Returns:
        An Optional with the boolean value of such an option if it exists; an empty Optional otherwise
      • getThirdOptionUserValue

        default Optional<User> getThirdOptionUserValue​()
        Gets the user value of the third option (if present). Note: This method only respects cached users. To fetch the user from Discord if the user is not cached, use requestThirdOptionUserValue().
        Returns:
        An Optional with the user value of such an option if it exists; an empty Optional otherwise
      • requestThirdOptionUserValue

        default Optional<CompletableFuture<User>> requestThirdOptionUserValue​()
        Gets the user value of the third option (if present).
        Returns:
        An Optional with the user value of such an option if it exists; an empty Optional otherwise
      • getThirdOptionChannelValue

        default Optional<ServerChannel> getThirdOptionChannelValue​()
        Gets the channel value of the third option (if present).
        Returns:
        An Optional with the channel value of such an option if it exists; an empty Optional otherwise
      • getThirdOptionRoleValue

        default Optional<Role> getThirdOptionRoleValue​()
        Gets the role value of the third option (if present).
        Returns:
        An Optional with the role value of such an option if it exists; an empty Optional otherwise
      • getThirdOptionMentionableValue

        default Optional<Mentionable> getThirdOptionMentionableValue​()
        Gets the mentionable value of the third option (if present) 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, use requestThirdOptionMentionableValue().
        Returns:
        An Optional with the mentionable value of such an option if it exists; an empty Optional otherwise
      • requestThirdOptionMentionableValue

        default Optional<CompletableFuture<Mentionable>> requestThirdOptionMentionableValue​()
        Gets the mentionable value of the third option (if present) which may be a user, channel or role.
        Returns:
        An Optional with the mentionable value of such an option if it exists; an empty Optional otherwise
      • getOptionByName

        default Optional<SlashCommandInteractionOption> getOptionByName​(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
      • getOptionStringValueByName

        default Optional<String> getOptionStringValueByName​(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
      • getOptionIntValueByName

        default Optional<Integer> getOptionIntValueByName​(String name)
        Gets the integer value of an option having the specified name.
        Parameters:
        name - The name of the option to search for.
        Returns:
        An Optional with the integer value of such an option if it exists; an empty Optional otherwise
      • getOptionBooleanValueByName

        default Optional<Boolean> getOptionBooleanValueByName​(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 Optional<User> getOptionUserValueByName​(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, use requestOptionUserValueByName().
        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 Optional<CompletableFuture<User>> requestOptionUserValueByName​(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 Optional<ServerChannel> getOptionChannelValueByName​(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 Optional<Role> getOptionRoleValueByName​(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 Optional<Mentionable> getOptionMentionableValueByName​(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, use requestOptionMentionableValueByName().
        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 Optional<CompletableFuture<Mentionable>> requestOptionMentionableValueByName​(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
      • getOptionByIndex

        default 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
      • getOptionStringValueByIndex

        default Optional<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
      • getOptionIntValueByIndex

        default Optional<Integer> getOptionIntValueByIndex​(int index)
        Gets the integer value of an option at the specified index.
        Parameters:
        index - The index of the option to search for.
        Returns:
        An Optional with the integer value of such an option if it exists; an empty Optional otherwise
      • getOptionBooleanValueByIndex

        default Optional<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 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, use requestOptionUserValueByIndex().
        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 Optional<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 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 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 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, use requestOptionMentionableValueByIndex().
        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 Optional<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