Class AutoCompleteUtils

java.lang.Object
xyz.dynxsty.dih4jda.util.AutoCompleteUtils

public class AutoCompleteUtils extends Object
Utility class that contains some useful methods regarding the AutoComplete system.
Since:
v1.4
  • Method Summary

    Modifier and Type
    Method
    Description
    static List<net.dv8tion.jda.api.interactions.commands.Command.Choice>
    filterChoices(String filter, List<net.dv8tion.jda.api.interactions.commands.Command.Choice> choices)
    Filters all AutoComplete choices based on the user's current input.
    static List<net.dv8tion.jda.api.interactions.commands.Command.Choice>
    filterChoices(String filter, net.dv8tion.jda.api.interactions.commands.Command.Choice... choices)
    Filters all AutoComplete choices based on the user's current input.
    static List<net.dv8tion.jda.api.interactions.commands.Command.Choice>
    filterChoices(net.dv8tion.jda.api.events.interaction.command.CommandAutoCompleteInteractionEvent event, List<net.dv8tion.jda.api.interactions.commands.Command.Choice> choices)
    Filters all AutoComplete choices based on the user's current input.
    static List<net.dv8tion.jda.api.interactions.commands.Command.Choice>
    filterChoices(net.dv8tion.jda.api.events.interaction.command.CommandAutoCompleteInteractionEvent event, net.dv8tion.jda.api.interactions.commands.Command.Choice... choices)
    Filters all AutoComplete choices based on the user's current input.

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • filterChoices

      @Nonnull public static List<net.dv8tion.jda.api.interactions.commands.Command.Choice> filterChoices(@Nonnull net.dv8tion.jda.api.events.interaction.command.CommandAutoCompleteInteractionEvent event, @Nonnull List<net.dv8tion.jda.api.interactions.commands.Command.Choice> choices)
      Filters all AutoComplete choices based on the user's current input.
      
       return event.replyChoices(AutoCompleteUtils.filterChoices(event, choices));
       
      Parameters:
      event - The CommandAutoCompleteInteractionEvent that was fired.
      choices - A List of Command.Choices.
      Returns:
      The filtered List of Command.Choices.
      Since:
      v1.4
    • filterChoices

      @Nonnull public static List<net.dv8tion.jda.api.interactions.commands.Command.Choice> filterChoices(@Nonnull net.dv8tion.jda.api.events.interaction.command.CommandAutoCompleteInteractionEvent event, @Nonnull net.dv8tion.jda.api.interactions.commands.Command.Choice... choices)
      Filters all AutoComplete choices based on the user's current input.
      
       return event.replyChoices(AutoCompleteUtils.filterChoices(event, choices));
       
      Parameters:
      event - The CommandAutoCompleteInteractionEvent that was fired.
      choices - An array of Command.Choices.
      Returns:
      The filtered List of Command.Choices.
      Since:
      v1.4
    • filterChoices

      @Nonnull public static List<net.dv8tion.jda.api.interactions.commands.Command.Choice> filterChoices(@Nonnull String filter, @Nonnull List<net.dv8tion.jda.api.interactions.commands.Command.Choice> choices)
      Filters all AutoComplete choices based on the user's current input.
      
       return event.replyChoices(AutoCompleteUtils.filterChoices("abc", choices));
       
      Parameters:
      filter - The filter.
      choices - A List of Command.Choices.
      Returns:
      The filtered List of Command.Choices.
      Since:
      v1.4
    • filterChoices

      @Nonnull public static List<net.dv8tion.jda.api.interactions.commands.Command.Choice> filterChoices(@Nonnull String filter, @Nonnull net.dv8tion.jda.api.interactions.commands.Command.Choice... choices)
      Filters all AutoComplete choices based on the user's current input.
      
       return event.replyChoices(AutoCompleteUtils.filterChoices("abc", choices));
       
      Parameters:
      filter - The filter.
      choices - A List of Command.Choices.
      Returns:
      The filtered List of Command.Choices.
      Since:
      v1.4