Package com.dianxin.tori.api.interaction
Class ComponentRegistrar
java.lang.Object
com.dianxin.tori.api.interaction.ComponentRegistrar
A registry class responsible for managing and routing Discord UI Component interactions
such as Buttons, String Select Menus, and Entity Select Menus.
-
Constructor Summary
ConstructorsConstructorDescriptionConstructs a new ComponentRegistrar for the specified bot. -
Method Summary
Modifier and TypeMethodDescriptionGets the base bot instance associated with this registrar.@Nullable EntitySelectMenuRetrieves a registered Entity Select Menu by its custom ID.getJda()Gets the JDA instance associated with this registrar.@Nullable StringSelectMenuRetrieves a registered String Select Menu by its custom ID.voidonButton(ButtonInteractionEvent event) Processes an incoming button click event and routes it to the corresponding registered handler.voidProcesses an incoming entity select menu event and routes it to the corresponding registered handler.voidProcesses an incoming string select menu event and routes it to the corresponding registered handler.voidregister(IButtonHandler handler) Registers a new button handler into the registry.voidregister(IEntitySelectMenuHandler handler) Registers a new entity select menu handler into the registry.voidregister(IStringSelectMenuHandler handler) Registers a new string select menu handler into the registry.
-
Constructor Details
-
ComponentRegistrar
Constructs a new ComponentRegistrar for the specified bot.- Parameters:
bot- TheJavaDiscordBotinstance that owns this registrar.
-
-
Method Details
-
register
Registers a new entity select menu handler into the registry.- Parameters:
handler- TheIEntitySelectMenuHandlerto register.
-
register
Registers a new string select menu handler into the registry.- Parameters:
handler- TheIStringSelectMenuHandlerto register.
-
register
Registers a new button handler into the registry.- Parameters:
handler- TheIButtonHandlerto register.
-
onEntity
Processes an incoming entity select menu event and routes it to the corresponding registered handler.- Parameters:
event- TheEntitySelectInteractionEventtriggered by Discord.
-
onString
Processes an incoming string select menu event and routes it to the corresponding registered handler.- Parameters:
event- TheStringSelectInteractionEventtriggered by Discord.
-
onButton
Processes an incoming button click event and routes it to the corresponding registered handler.- Parameters:
event- TheButtonInteractionEventtriggered by Discord.
-
getJda
Gets the JDA instance associated with this registrar.- Returns:
- The
JDAinstance.
-
getBaseBot
Gets the base bot instance associated with this registrar.- Returns:
- The
JavaDiscordBotinstance.
-
getStringSelectMenu
Retrieves a registered String Select Menu by its custom ID.- Parameters:
id- The custom ID of the menu to retrieve.- Returns:
- The
StringSelectMenuif found, ornullif not registered.
-
getEntitySelectMenu
Retrieves a registered Entity Select Menu by its custom ID.- Parameters:
id- The custom ID of the menu to retrieve.- Returns:
- The
EntitySelectMenuif found, ornullif not registered.
-