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 GenericInteractionCreateEvent
s.
Each EventHandler
is split into 3 steps:
-
Preparation (
prepare(GenericInteractionCreateEvent, Runtime)
): In this step theInvocationContext
is created from the jda event and the involvedRuntime
. -
Middleware execution: In this step all registered
Middleware
s are executed ordered by theirPriority
. -
Invocation (
invoke(InvocationContext, Runtime)
): In this step the user implemented method is called with help of the rightInteractionDefinition
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final TypeAdapters
protected final DispatchingContext
protected final ErrorMessageFactory
static final ThreadLocal
<Boolean> static final org.slf4j.Logger
protected final Middlewares
protected final InteractionRegistry
-
Constructor Summary
Constructors -
Method Summary
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.util.function.BiConsumer
andThen
-
Field Details
-
INVOCATION_PERMITTED
-
log
public static final org.slf4j.Logger log -
dispatchingContext
-
middlewares
-
registry
-
adapterRegistry
-
errorMessageFactory
-
-
Constructor Details
-
EventHandler
-
-
Method Details
-
prepare
@Nullable protected abstract @Nullable InvocationContext<T> prepare(@NotNull T event, @NotNull @NotNull Runtime runtime) -
accept
-