Class MessageMenuInteraction


  • public final class MessageMenuInteraction
    extends Object
    • Method Detail

      • getEvent

        public discord4j.core.event.domain.message.MessageCreateEvent getEvent()
      • getFlags

        public FlagSet getFlags()
      • getTranslator

        public Translator getTranslator()
        Gets the translator associated to the context the interactive menu is run.
        Returns:
        the translator
      • update

        public <T> T update​(String varName,
                            UnaryOperator<T> valueUpdater)
        Updates a variable in the context of this interaction.
        Type Parameters:
        T - the type of value
        Parameters:
        varName - the variable name
        valueUpdater - the function that updates the value. The function may return null to signal that the variable should be unset
        Returns:
        the value after update
        Throws:
        NoSuchElementException - if attempt to update a non-existing variable
        ClassCastException - if the value isn't of type T
      • update

        public <T> T update​(String varName,
                            UnaryOperator<T> valueUpdater,
                            T defaultValue)
        Updates a variable in the context of this interaction.
        Type Parameters:
        T - the type of value
        Parameters:
        varName - the variable name
        valueUpdater - the function that updates the value. The function may return null to signal that the variable should be unset
        defaultValue - the value to take if the variable is not set
        Returns:
        the value after update
        Throws:
        ClassCastException - if the value isn't of type T
      • set

        public <T> void set​(String varName,
                            @Nullable
                            T value)
        Sets a variable in the context of this interaction to the given value.
        Type Parameters:
        T - the type of value
        Parameters:
        varName - the variable name
        value - the new value, or null to unset
      • get

        public <T> T get​(String varName)
        Gets a variable in the context of this interaction.
        Type Parameters:
        T - the expected type of the value
        Parameters:
        varName - teh variable name
        Returns:
        the value associated to the variable
        Throws:
        NoSuchElementException - if no variable for the given name is set
        ClassCastException - if the value is not of type T
      • getMenuMessage

        public discord4j.core.object.entity.Message getMenuMessage()
        Gets the menu message prompting the user for interaction.
        Returns:
        the Discord message of the menu
      • closeMenu

        public void closeMenu()
        Closes the menu. No more interactions will be registered once this call returns.