Class FollowupInteractionHandler

java.lang.Object
discord4j.rest.interaction.FollowupInteractionHandler
All Implemented Interfaces:
InteractionHandler

@Experimental public class FollowupInteractionHandler extends Object implements InteractionHandler
An interaction handler that can have an additional asynchronous sequence for followup actions using withFollowup(Function).
  • Method Details

    • response

      public discord4j.discordjson.json.InteractionResponseData response()
      Description copied from interface: InteractionHandler
      Return the response to be sent to Discord on interaction create.
      Specified by:
      response in interface InteractionHandler
      Returns:
      the raw data to build an initial interaction response
    • onInteractionResponse

      public Publisher<?> onInteractionResponse(InteractionResponse response)
      Description copied from interface: InteractionHandler
      Return a reactive sequence to work with an interaction token after an initial response has been sent.
      Specified by:
      onInteractionResponse in interface InteractionHandler
      Parameters:
      response - a handler with all common actions to derive the asynchronous followup sequence
      Returns:
      a publisher, like a Mono or Flux to be subscribed for the duration of the interaction token, after which will be cancelled through Flux.take(Duration) semantics.
    • withFollowup

      public InteractionHandler withFollowup(Function<InteractionResponse,Publisher<?>> followupHandler)
      Create an interaction handler that can have additional behavior after an interaction is acknowledged. The additional behavior is supplied a reactive sequence and will be subscribed for the duration of the interaction token.
      Parameters:
      followupHandler - the function to retrieve a sequence from an interaction, for followup actions
      Returns:
      this handler with the included followup actions