Class CategorizeHelper

java.lang.Object
com.github.ygimenez.model.helper.BaseHelper<CategorizeHelper,​Map<net.dv8tion.jda.api.entities.emoji.Emoji,​Page>>
com.github.ygimenez.model.helper.CategorizeHelper

public class CategorizeHelper extends BaseHelper<CategorizeHelper,​Map<net.dv8tion.jda.api.entities.emoji.Emoji,​Page>>
Helper class for building categorize events, safe for reuse.
  • Constructor Details

    • CategorizeHelper

      public CategorizeHelper(boolean useButtons)
      Creates a new categorize event helper with the default map implementation (LinkedHashMap).
      Parameters:
      useButtons - Whether to use interaction buttons or legacy reaction-based buttons.
    • CategorizeHelper

      public CategorizeHelper(Map<net.dv8tion.jda.api.entities.emoji.Emoji,​Page> categories, boolean useButtons)
      Creates a new categorize event helper with the supplied map.
      Parameters:
      categories - A map containing the initial categories.
      useButtons - Whether to use interaction buttons or legacy reaction-based buttons.
  • Method Details

    • addCategory

      public CategorizeHelper addCategory(net.dv8tion.jda.api.entities.emoji.Emoji emoji, Page page)
      Adds a new category to the map.
      Parameters:
      emoji - The emoji representing this category.
      page - The page linked to this category.
      Returns:
      The CategorizeHelper instance for chaining convenience.
    • getComponents

      public <Out extends net.dv8tion.jda.api.utils.messages.MessageRequest<Out>> List<net.dv8tion.jda.api.interactions.components.LayoutComponent> getComponents(Out action)
      Description copied from class: BaseHelper
      Retrieves the List of Components generated by this helper.
      Specified by:
      getComponents in class BaseHelper<CategorizeHelper,​Map<net.dv8tion.jda.api.entities.emoji.Emoji,​Page>>
      Type Parameters:
      Out - Generic for a MessageRequest
      Parameters:
      action - A message event (either create or edit).
      Returns:
      The list of components.
    • shouldUpdate

      public boolean shouldUpdate(net.dv8tion.jda.api.entities.Message msg)
      Calculates whether the Message needs to have buttons applied onto or not.
      Specified by:
      shouldUpdate in class BaseHelper<CategorizeHelper,​Map<net.dv8tion.jda.api.entities.emoji.Emoji,​Page>>
      Parameters:
      msg - The Message to be checked.
      Returns:
      Whether it needs to be updated or not.