Class Event<T extends GenericInteractionCreateEvent>
- Type Parameters:
T- the type ofGenericInteractionCreateEventthis event represents
- All Implemented Interfaces:
ISnowflake, Interaction
- Direct Known Subclasses:
AutoCompleteEvent, ReplyableEvent
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:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidCloses the underlyingRuntime.@Nullable Channellong@Nullable GuildgetGuild()longgetJDA()@Nullable MembergetToken()intgetUser()i18n()Gets theI18ninstance.<I> @Nullable IinteractionInstance(Class<I> interactionClass) Returns an instance of a class annotated withInteraction, that is bound to the underlyingRuntime.booleanjdaEvent()Returns the underlyingGenericInteractionCreateEventof this eventkv()Returns theKeyValueStoreof thisRuntime.Gets a localization message for the given key using the underlyingI18ninstance.Gets theMessageResolverinstanceResolved the given message with help of the underlyingMessageResolverinstance, thus performing localization and emoji resolution.Returns the id of theRuntimethis event is dispatched in.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface Interaction
getChannelId, getChannelType, getGuildChannel, getGuildLocale, getMessageChannel, getType, isFromAttachedGuild, isFromGuildMethods inherited from interface ISnowflake
getId, getTimeCreated
-
Constructor Details
-
Event
public Event()
-
-
Method Details
-
jdaEvent
Returns the underlyingGenericInteractionCreateEventof 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.Explicitis used. -
kv
Returns the
KeyValueStoreof thisRuntime.The
KeyValueStorecan be accessed during theMiddlewareexecution 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
-
interactionInstance
Returns an instance of a class annotated withInteraction, that is bound to the underlyingRuntime.- Returns:
- the interaction class instance
-
i18n
-
messageResolver
Gets theMessageResolverinstance- Returns:
- the
MessageResolverinstance
-
localize
Gets a localization message for the given key using the underlying
I18ninstance.Automatically resolves the
LocaleusingGenericInteractionCreateEvent.getUserLocale(). UseI18n.localize(Locale, String, Entry...)(obtained viai18n()) if you want to use a different locale.- Returns:
- the localized message or the key if not found
-
resolve
Resolved the given message with help of the underlying
MessageResolverinstance, thus performing localization and emoji resolution.Automatically resolves the
LocaleusingGenericInteractionCreateEvent.getUserLocale(). UseMessageResolver.resolve(String, Locale, Entry...)(obtained viamessageResolver()) if you want to use a different locale.- Returns:
- the resolved message
-
getTypeRaw
public int getTypeRaw()- Specified by:
getTypeRawin interfaceInteraction
-
getToken
- Specified by:
getTokenin interfaceInteraction
-
getGuild
- Specified by:
getGuildin interfaceInteraction
-
getUser
- Specified by:
getUserin interfaceInteraction
-
getMember
- Specified by:
getMemberin interfaceInteraction
-
isAcknowledged
public boolean isAcknowledged()- Specified by:
isAcknowledgedin interfaceInteraction
-
getChannel
- Specified by:
getChannelin interfaceInteraction
-
getChannelIdLong
public long getChannelIdLong()- Specified by:
getChannelIdLongin interfaceInteraction
-
getUserLocale
- Specified by:
getUserLocalein interfaceInteraction
-
getEntitlements
- Specified by:
getEntitlementsin interfaceInteraction
-
getJDA
- Specified by:
getJDAin interfaceInteraction
-
getIdLong
public long getIdLong()- Specified by:
getIdLongin interfaceISnowflake
-
getIntegrationOwners
- Specified by:
getIntegrationOwnersin interfaceInteraction
-
getContext
- Specified by:
getContextin interfaceInteraction
-