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
ConstructorDescriptionButtonWrapper(net.dv8tion.jda.api.entities.User user, net.dv8tion.jda.api.interactions.InteractionHook hook, net.dv8tion.jda.api.interactions.components.buttons.Button button, Map<String,List<?>> dropdownValues, net.dv8tion.jda.api.entities.Message message)
Constructs a newButtonWrapper
instance. -
Method Summary
Modifier and TypeMethodDescriptionnet.dv8tion.jda.api.interactions.components.buttons.Button
Retrieves theButton
that triggered the event.net.dv8tion.jda.api.entities.channel.middleman.MessageChannel
Shortcut for retrieving theMessage
'sMessageChannel
.Retrieves theSelectMenu
values currently set for this context.net.dv8tion.jda.api.interactions.InteractionHook
getHook()
Retrieves the event'sInteractionHook
.net.dv8tion.jda.api.entities.Member
Retrieves theMember
who pressed the button.net.dv8tion.jda.api.entities.Message
Retrieves the parentMessage
.net.dv8tion.jda.api.entities.User
getUser()
Retrieves theUser
who pressed the button.net.dv8tion.jda.api.entities.Message
Reloads current parentMessage
instance, retrieving the latest state of it (useful when doingButton
updates 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, Map<String,List<?>> dropdownValues, net.dv8tion.jda.api.entities.Message message)Constructs a newButtonWrapper
instance. You probably shouldn't be creating one yourself.- Parameters:
user
- TheUser
who pressed the button.hook
- TheInteractionHook
referencing interaction event, or null if it's not an interaction.button
- TheButton
that triggered this event.dropdownValues
- The currently selectedSelectMenu
values, if any.message
- The parentMessage
.
-
-
Method Details
-
getUser
public net.dv8tion.jda.api.entities.User getUser()Retrieves theUser
who pressed the button.- Returns:
- The
User
who pressed the button.
-
getMember
Retrieves theMember
who pressed the button.- Returns:
- The
Member
who 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
InteractionHook
referencing interaction event, or null if it's not an interaction.
-
getButton
@Nullable public net.dv8tion.jda.api.interactions.components.buttons.Button getButton()Retrieves theButton
that triggered the event.- Returns:
- The
Button
that triggered the event, or null if it's not an interaction.
-
getDropdownValues
Retrieves theSelectMenu
values currently set for this context.- Returns:
- The
SelectMenu
values.
-
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 parentMessage
instance, retrieving the latest state of it (useful when doingButton
updates 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
.
-