Package com.github.ygimenez.model.helper
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 Summary
ConstructorsConstructorDescriptionCategorizeHelper(boolean useButtons)Creates a new categorize event helper with the default map implementation (LinkedHashMap).CategorizeHelper(Map<net.dv8tion.jda.api.entities.emoji.Emoji,Page> categories, boolean useButtons)Creates a new categorize event helper with the supplied map. -
Method Summary
Modifier and TypeMethodDescriptionaddCategory(net.dv8tion.jda.api.entities.emoji.Emoji emoji, Page page)Adds a new category to the map.<Out extends net.dv8tion.jda.api.utils.messages.MessageRequest<Out>>
List<net.dv8tion.jda.api.interactions.components.LayoutComponent>getComponents(Out action)Retrieves theListofComponents generated by this helper.booleanshouldUpdate(net.dv8tion.jda.api.entities.Message msg)Calculates whether theMessageneeds to have buttons applied onto or not.Methods inherited from class com.github.ygimenez.model.helper.BaseHelper
apply, canInteract, getContent, getTimeout, isCancellable, isUsingButtons, setCancellable, setCanInteract, setTimeout
-
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
Adds a new category to the map.- Parameters:
emoji- The emoji representing this category.page- The page linked to this category.- Returns:
- The
CategorizeHelperinstance 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:BaseHelperRetrieves theListofComponents generated by this helper.- Specified by:
getComponentsin classBaseHelper<CategorizeHelper,Map<net.dv8tion.jda.api.entities.emoji.Emoji,Page>>- Type Parameters:
Out- Generic for aMessageRequest- 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 theMessageneeds to have buttons applied onto or not.- Specified by:
shouldUpdatein classBaseHelper<CategorizeHelper,Map<net.dv8tion.jda.api.entities.emoji.Emoji,Page>>- Parameters:
msg- TheMessageto be checked.- Returns:
- Whether it needs to be updated or not.
-