Class EventHandler<T extends net.dv8tion.jda.api.events.interaction.GenericInteractionCreateEvent>

java.lang.Object
com.github.kaktushose.jda.commands.dispatching.handling.EventHandler<T>
All Implemented Interfaces:
BiConsumer<T,Runtime>
Direct Known Subclasses:
AutoCompleteHandler, ComponentHandler, ContextCommandHandler, ModalHandler, SlashCommandHandler

@Internal public abstract sealed class EventHandler<T extends net.dv8tion.jda.api.events.interaction.GenericInteractionCreateEvent> extends Object implements BiConsumer<T,Runtime> permits AutoCompleteHandler, ComponentHandler, ModalHandler, ContextCommandHandler, SlashCommandHandler

Implementations of this class are handling specific GenericInteractionCreateEvents.

Each EventHandler is split into 3 steps:

  1. Preparation (prepare(GenericInteractionCreateEvent, Runtime)): In this step the InvocationContext is created from the jda event and the involved Runtime.

  2. Middleware execution: In this step all registered Middlewares are executed ordered by their Priority.

  3. Invocation (invoke(InvocationContext, Runtime)): In this step the user implemented method is called with help of the right InteractionDefinition

  • Field Details

  • Constructor Details

  • Method Details

    • prepare

      @Nullable protected abstract @Nullable InvocationContext<T> prepare(@NotNull T event, @NotNull @NotNull Runtime runtime)
    • accept

      public final void accept(T e, Runtime runtime)
      Specified by:
      accept in interface BiConsumer<T extends net.dv8tion.jda.api.events.interaction.GenericInteractionCreateEvent,Runtime>