Class Event<T extends GenericInteractionCreateEvent>
java.lang.Object
com.github.kaktushose.jda.commands.dispatching.events.Event<T>
- Type Parameters:
T
- the type ofGenericInteractionCreateEvent
this event represents
- All Implemented Interfaces:
ISnowflake
,Interaction
- Direct Known Subclasses:
AutoCompleteEvent
,ReplyableEvent
public abstract sealed class Event<T extends GenericInteractionCreateEvent>
extends Object
implements Interaction
permits ReplyableEvent<T>, AutoCompleteEvent
Abstract base event for all interaction events, like CommandEvent
.
This class also holds the GenericInteractionCreateEvent
and provides some shortcut methods to directly access its
content.
- See Also:
-
Field Summary
-
Constructor Summary
ModifierConstructorDescriptionprotected
Event
(T event, @NotNull InteractionRegistry registry, @NotNull com.github.kaktushose.jda.commands.dispatching.Runtime runtime) Constructs a new Event. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Closes the underlyingRuntime
.@Nullable Channel
long
@NotNull List
<Entitlement> @Nullable Guild
getGuild()
long
@NotNull JDA
getJDA()
@Nullable Member
@NotNull String
getToken()
int
@NotNull User
getUser()
@NotNull DiscordLocale
boolean
jdaEvent()
Returns the underlyingGenericInteractionCreateEvent
of this event@NotNull KeyValueStore
kv()
Returns theKeyValueStore
of thisRuntime
.@NotNull String
Returns the id of theRuntime
this event is dispatched in.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface net.dv8tion.jda.api.interactions.Interaction
getChannelId, getChannelType, getGuildChannel, getGuildLocale, getMessageChannel, getType, isFromGuild
Methods inherited from interface net.dv8tion.jda.api.entities.ISnowflake
getId, getTimeCreated
-
Field Details
-
event
-
registry
-
-
Constructor Details
-
Event
protected Event(@NotNull T event, @NotNull @NotNull InteractionRegistry registry, @NotNull @NotNull com.github.kaktushose.jda.commands.dispatching.Runtime runtime) Constructs a new Event.- Parameters:
event
- the subtypeEvent
ofGenericInteractionCreateEvent
registry
- the correspondingInteractionRegistry
runtime
- theRuntime
this event lives in
-
-
Method Details
-
jdaEvent
Returns the underlyingGenericInteractionCreateEvent
of this event- Returns:
- the
GenericInteractionCreateEvent
-
runtimeId
-
closeRuntime
public void closeRuntime()Closes the underlying
Runtime
. This will ignore any new jda events belonging to this interaction, resulting in the freeing of occupied resources for gc.This is only needed if the expiration strategy
ExpirationStrategy.Explicit
is used. -
kv
Returns the
KeyValueStore
of thisRuntime
.The
KeyValueStore
can be accessed during theMiddleware
execution as well as any interaction execution. Its content will be the same as long as the executions take place in the sameRuntime
.- Returns:
- the
KeyValueStore
-
getTypeRaw
public int getTypeRaw()- Specified by:
getTypeRaw
in interfaceInteraction
-
getToken
- Specified by:
getToken
in interfaceInteraction
-
getGuild
- Specified by:
getGuild
in interfaceInteraction
-
getUser
- Specified by:
getUser
in interfaceInteraction
-
getMember
- Specified by:
getMember
in interfaceInteraction
-
isAcknowledged
public boolean isAcknowledged()- Specified by:
isAcknowledged
in interfaceInteraction
-
getChannel
- Specified by:
getChannel
in interfaceInteraction
-
getChannelIdLong
public long getChannelIdLong()- Specified by:
getChannelIdLong
in interfaceInteraction
-
getUserLocale
- Specified by:
getUserLocale
in interfaceInteraction
-
getEntitlements
- Specified by:
getEntitlements
in interfaceInteraction
-
getJDA
- Specified by:
getJDA
in interfaceInteraction
-
getIdLong
public long getIdLong()- Specified by:
getIdLong
in interfaceISnowflake
-