Class ButtonWrapper

java.lang.Object
com.github.ygimenez.model.ButtonWrapper

public class ButtonWrapper extends Object
  • Constructor Summary

    Constructors
    Constructor
    Description
    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 new ButtonWrapper instance.
  • Method Summary

    Modifier and Type
    Method
    Description
    net.dv8tion.jda.api.interactions.components.buttons.Button
    Retrieves the Button that triggered the event.
    net.dv8tion.jda.api.entities.channel.middleman.MessageChannel
    Shortcut for retrieving the Message's MessageChannel.
    Map<String,​List<?>>
    Retrieves the SelectMenu values currently set for this context.
    net.dv8tion.jda.api.interactions.InteractionHook
    Retrieves the event's InteractionHook.
    net.dv8tion.jda.api.entities.Member
    Retrieves the Member who pressed the button.
    net.dv8tion.jda.api.entities.Message
    Retrieves the parent Message.
    net.dv8tion.jda.api.entities.User
    Retrieves the User who pressed the button.
    net.dv8tion.jda.api.entities.Message
    Reloads current parent Message instance, retrieving the latest state of it (useful when doing Button updates or actions which depend on message content).

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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 new ButtonWrapper instance. You probably shouldn't be creating one yourself.
      Parameters:
      user - The User who pressed the button.
      hook - The InteractionHook referencing interaction event, or null if it's not an interaction.
      button - The Button that triggered this event.
      dropdownValues - The currently selected SelectMenu values, if any.
      message - The parent Message.
  • Method Details

    • getUser

      public net.dv8tion.jda.api.entities.User getUser()
      Retrieves the User who pressed the button.
      Returns:
      The User who pressed the button.
    • getMember

      public net.dv8tion.jda.api.entities.Member getMember() throws IllegalStateException
      Retrieves the Member who pressed the button.
      Returns:
      The Member who pressed the button.
      Throws:
      IllegalStateException - If the event didn't happen in a Guild.
    • getHook

      @Nullable public net.dv8tion.jda.api.interactions.InteractionHook getHook()
      Retrieves the event's InteractionHook.
      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 the Button that triggered the event.
      Returns:
      The Button that triggered the event, or null if it's not an interaction.
    • getDropdownValues

      public Map<String,​List<?>> getDropdownValues()
      Retrieves the SelectMenu values currently set for this context.
      Returns:
      The SelectMenu values.
    • getMessage

      public net.dv8tion.jda.api.entities.Message getMessage()
      Retrieves the parent Message.
      Returns:
      The parent Message.
    • reloadMessage

      public net.dv8tion.jda.api.entities.Message reloadMessage()
      Reloads current parent Message instance, retrieving the latest state of it (useful when doing Button 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 the Message's MessageChannel.
      Returns:
      The parent Message's MessageChannel.