Record Class InvocationContext<T extends GenericInteractionCreateEvent>
java.lang.Object
java.lang.Record
io.github.kaktushose.jdac.dispatching.context.InvocationContext<T>
- Type Parameters:
T- The used type ofGenericInteractionCreateEvent- Record Components:
event- the underlying jda eventkeyValueStore- theKeyValueStorebelonging to this interaction over its whole lifetimedefinition- theInteractionDefinitiondefining this interaction (referring to the user defined method)replyConfig- theInteractionDefinition.ReplyConfigto userawArguments- the arguments used to call the final user defined method viaInvokable.invoke(java.lang.Object, io.github.kaktushose.jdac.dispatching.context.InvocationContext)
- All Implemented Interfaces:
ErrorMessageFactory.ErrorContext
public record InvocationContext<T extends GenericInteractionCreateEvent>(T extends GenericInteractionCreateEvent event, KeyValueStore keyValueStore, InteractionDefinition definition, InteractionDefinition.ReplyConfig replyConfig, SequencedCollection<@Nullable Object> rawArguments)
extends Record
implements ErrorMessageFactory.ErrorContext
Bundles data that is important for the execution of an interaction, especially for invoking the user defined method.
-
Constructor Summary
ConstructorsConstructorDescriptionInvocationContext(T event, KeyValueStore keyValueStore, InteractionDefinition definition, InteractionDefinition.ReplyConfig replyConfig, SequencedCollection<@Nullable Object> rawArguments) Creates an instance of aInvocationContextrecord class. -
Method Summary
Modifier and TypeMethodDescriptionSequencedCollection<@Nullable Object> voidcancel(MessageTopLevelComponent component, Entry... placeholders) Stops further execution of this invocation at the next suitable moment.voidcancel(MessageCreateData errorMessage) Stops further execution of this invocation at the next suitable moment.booleanReturns the value of thedefinitionrecord component.final booleanIndicates whether some other object is "equal to" this one.event()Returns the value of theeventrecord component.final inthashCode()Returns a hash code value for this object.Returns the value of thekeyValueStorerecord component.SequencedCollection<@Nullable Object> Returns the value of therawArgumentsrecord component.Returns the value of thereplyConfigrecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
InvocationContext
public InvocationContext(T event, KeyValueStore keyValueStore, InteractionDefinition definition, InteractionDefinition.ReplyConfig replyConfig, SequencedCollection<@Nullable Object> rawArguments) Creates an instance of aInvocationContextrecord class.- Parameters:
event- the value for theeventrecord componentkeyValueStore- the value for thekeyValueStorerecord componentdefinition- the value for thedefinitionrecord componentreplyConfig- the value for thereplyConfigrecord componentrawArguments- the value for therawArgumentsrecord component
-
-
Method Details
-
arguments
- Returns:
- same as
data()#rawArguementsbut withOptionals replaced bynull
-
cancel
Stops further execution of this invocation at the next suitable moment.- Parameters:
errorMessage- the error message that should be sent to the user as a reply- Implementation Note:
- This will interrupt the current event thread
-
cancel
Stops further execution of this invocation at the next suitable moment.- Parameters:
component- theMessageTopLevelComponentthat should be sent to the user as an error messageplaceholders- theEntryplaceholders to use for message resolution- Implementation Note:
- This will interrupt the current event thread
-
cancelled
public boolean cancelled()- Returns:
- if the current invocation is canceled
-
toString
-
hashCode
-
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
event
Returns the value of theeventrecord component.- Specified by:
eventin interfaceErrorMessageFactory.ErrorContext- Returns:
- the value of the
eventrecord component
-
keyValueStore
Returns the value of thekeyValueStorerecord component.- Returns:
- the value of the
keyValueStorerecord component
-
definition
Returns the value of thedefinitionrecord component.- Specified by:
definitionin interfaceErrorMessageFactory.ErrorContext- Returns:
- the value of the
definitionrecord component
-
replyConfig
Returns the value of thereplyConfigrecord component.- Returns:
- the value of the
replyConfigrecord component
-
rawArguments
Returns the value of therawArgumentsrecord component.- Returns:
- the value of the
rawArgumentsrecord component
-