Package discord4j.rest.interaction
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 usingwithFollowup(Function).
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Publisher<?>onInteractionResponse(InteractionResponse response)Return a reactive sequence to work with an interaction token after an initial response has been sent.discord4j.discordjson.json.InteractionResponseDataresponse()Return the response to be sent to Discord on interaction create.InteractionHandlerwithFollowup(Function<InteractionResponse,Publisher<?>> followupHandler)Create an interaction handler that can have additional behavior after an interaction is acknowledged.
-
-
-
Method Detail
-
response
public discord4j.discordjson.json.InteractionResponseData response()
Description copied from interface:InteractionHandlerReturn the response to be sent to Discord on interaction create.- Specified by:
responsein interfaceInteractionHandler- Returns:
- the raw data to build an initial interaction response
-
onInteractionResponse
public Publisher<?> onInteractionResponse(InteractionResponse response)
Description copied from interface:InteractionHandlerReturn a reactive sequence to work with an interaction token after an initial response has been sent.- Specified by:
onInteractionResponsein interfaceInteractionHandler- Parameters:
response- a handler with all common actions to derive the asynchronous followup sequence- Returns:
- a publisher, like a
MonoorFluxto be subscribed for the duration of the interaction token, after which will be cancelled throughFlux.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
-
-