Package discord4j.rest.interaction
Class FollowupInteractionHandler
java.lang.Object
discord4j.rest.interaction.FollowupInteractionHandler
- All Implemented Interfaces:
InteractionHandler
An interaction handler that can have an additional asynchronous sequence for followup actions using
withFollowup(Function)
.-
Method Summary
Modifier and TypeMethodDescriptionPublisher<?>
onInteractionResponse
(InteractionResponse response) Return a reactive sequence to work with an interaction token after an initial response has been sent.discord4j.discordjson.json.InteractionResponseData
response()
Return the response to be sent to Discord on interaction create.withFollowup
(Function<InteractionResponse, Publisher<?>> followupHandler) Create an interaction handler that can have additional behavior after an interaction is acknowledged.
-
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 interfaceInteractionHandler
- Returns:
- the raw data to build an initial interaction response
-
onInteractionResponse
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 interfaceInteractionHandler
- Parameters:
response
- a handler with all common actions to derive the asynchronous followup sequence- Returns:
- a publisher, like a
Mono
orFlux
to be subscribed for the duration of the interaction token, after which will be cancelled throughFlux.take(Duration)
semantics.
-
withFollowup
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
-