Package com.github.ygimenez.model
Class ButtonWrapper
java.lang.Object
com.github.ygimenez.model.ButtonWrapper
Wrapper for
Pages.buttonize(net.dv8tion.jda.api.entities.Message, java.util.Map<net.dv8tion.jda.api.entities.emoji.Emoji, com.github.ygimenez.model.ThrowingConsumer<com.github.ygimenez.model.ButtonWrapper>>, boolean, boolean) arguments containing necessary data for processing.-
Constructor Summary
ConstructorsConstructorDescriptionButtonWrapper(net.dv8tion.jda.api.entities.User user, net.dv8tion.jda.api.interactions.InteractionHook hook, net.dv8tion.jda.api.interactions.components.buttons.Button button, net.dv8tion.jda.api.entities.Message message)Constructs a newButtonWrapperinstance. -
Method Summary
Modifier and TypeMethodDescriptionnet.dv8tion.jda.api.interactions.components.buttons.ButtonRetrieves theButtonthat triggered the event.net.dv8tion.jda.api.entities.channel.middleman.MessageChannelShortcut for retrieving theMessage'sMessageChannel.net.dv8tion.jda.api.interactions.InteractionHookgetHook()Retrieves the event'sInteractionHook.net.dv8tion.jda.api.entities.MemberRetrieves theMemberwho pressed the button.net.dv8tion.jda.api.entities.MessageRetrieves the parentMessage.net.dv8tion.jda.api.entities.UsergetUser()Retrieves theUserwho pressed the button.net.dv8tion.jda.api.entities.MessageReloads current parentMessageinstance, retrieving the latest state of it (useful when doingButtonupdates or actions which depend on message content).
-
Constructor Details
-
ButtonWrapper
public ButtonWrapper(net.dv8tion.jda.api.entities.User user, net.dv8tion.jda.api.interactions.InteractionHook hook, net.dv8tion.jda.api.interactions.components.buttons.Button button, net.dv8tion.jda.api.entities.Message message)Constructs a newButtonWrapperinstance. You probably shouldn't be creating one yourself.- Parameters:
user- TheUserwho pressed the button.hook- TheInteractionHookreferencing interaction event, or null if it's not an interaction.button- TheButtonthat triggered this event.message- The parentMessage.
-
-
Method Details
-
getUser
public net.dv8tion.jda.api.entities.User getUser()Retrieves theUserwho pressed the button.- Returns:
- The
Userwho pressed the button.
-
getMember
Retrieves theMemberwho pressed the button.- Returns:
- The
Memberwho pressed the button. - Throws:
IllegalStateException- If the event didn't happen in aGuild.
-
getHook
@Nullable public net.dv8tion.jda.api.interactions.InteractionHook getHook()Retrieves the event'sInteractionHook.- Returns:
- The
InteractionHookreferencing interaction event, or null if it's not an interaction.
-
getButton
@Nullable public net.dv8tion.jda.api.interactions.components.buttons.Button getButton()Retrieves theButtonthat triggered the event.- Returns:
- The
Buttonthat triggered the event, or null if it's not an interaction.
-
getMessage
public net.dv8tion.jda.api.entities.Message getMessage()Retrieves the parentMessage.- Returns:
- The parent
Message.
-
reloadMessage
public net.dv8tion.jda.api.entities.Message reloadMessage()Reloads current parentMessageinstance, retrieving the latest state of it (useful when doingButtonupdates or actions which depend on message content).- Returns:
- The reloaded
Message.
-
getChannel
public net.dv8tion.jda.api.entities.channel.middleman.MessageChannel getChannel()Shortcut for retrieving theMessage'sMessageChannel.- Returns:
- The parent
Message'sMessageChannel.
-