Class ModalEvent

All Implemented Interfaces:
ISnowflake, Interaction

public final class ModalEvent extends ReplyableEvent<ModalInteractionEvent>
This class is a subclass of Event. It provides additional features for replying to a ModalInteractionEvent as well as for retrieving the ModalMappings.
See Also:
  • Constructor Details

    • ModalEvent

      public ModalEvent()
  • Method Details

    • deferReply

      public void deferReply(boolean ephemeral)
      Description copied from class: ReplyableEvent

      Acknowledge this interaction and defer the reply to a later time.

      This will send a <Bot> is thinking... message in chat that will be updated later. This will use the passed boolean to set the ephemeral flag. If your initial deferred message is ephemeral it cannot be made non-ephemeral later. Use ReplyableEvent.deferReply() to use the InteractionDefinition.ReplyConfig for the ephemeral flag.

      You only have 3 seconds to acknowledge an interaction!

      When the acknowledgement is sent after the interaction expired, you will receive ErrorResponse.UNKNOWN_INTERACTION.

      Use ReplyableEvent.reply(String, Entry...) to reply directly.

      Specified by:
      deferReply in class ReplyableEvent<ModalInteractionEvent>
      Parameters:
      ephemeral - yes
    • deferEdit

      public void deferEdit()

      No-op acknowledgement of this interaction.

      This tells discord you intend to update the message that the triggering component is a part of instead of sending a reply message. You are not required to actually update the message, this will simply acknowledge that you accepted the interaction.

      You only have 3 seconds to acknowledge an interaction!

      When the acknowledgement is sent after the interaction expired, you will receive ErrorResponse.UNKNOWN_INTERACTION.

      Use ReplyableEvent.reply(String, Entry...) to edit it directly.

    • values

      public List<ModalMapping> values()
      Returns a List of ModalMappings representing the values input by the user for each field when the modal was submitted.
      Returns:
      Immutable List of ModalMappings
      See Also:
    • value

      public ModalMapping value(String customId)
      Convenience method to get a ModalMapping by its id from the List of ModalMappings.
      Parameters:
      customId - The custom id
      Returns:
      ModalMapping with this id, or null if not found
      Throws:
      NullPointerException - If no value was found for the provided id
      IllegalArgumentException - If the provided id is null
      See Also:
    • value

      public ModalMapping value(int uniqueId)
      Convenience method to get a ModalMapping by its numeric id from the List of ModalMappings
      Parameters:
      uniqueId - The uniqueId id
      Returns:
      ModalMapping with this numeric id, or null if not found
      Throws:
      NullPointerException - If no value was found for the provided id
      IllegalArgumentException - If the provided id is null
      See Also:
    • value

      public <T> io.github.kaktushose.proteus.conversion.ConversionResult<T> value(String customId, Class<T> type)
      Convenience method to get the value of a TextInput and convert it to the given type T via Proteus.
      Type Parameters:
      T - the type to convert to
      Parameters:
      customId - The custom id of the TextInput
      type - the Class of the type to convert to
      Returns:
      the ConversionResult
    • value

      public <T> io.github.kaktushose.proteus.conversion.ConversionResult<T> value(int uniqueId, Class<T> type)
      Convenience method to get the value of a TextInput and convert it to the given type T via Proteus.
      Type Parameters:
      T - the type to convert to
      Parameters:
      uniqueId - The unique id of the TextInput
      type - the Class of the type to convert to
      Returns:
      the ConversionResult