Record Class InvocationContext<T extends GenericInteractionCreateEvent>
java.lang.Object
java.lang.Record
com.github.kaktushose.jda.commands.dispatching.context.InvocationContext<T>
- Type Parameters:
T
- The used type ofGenericInteractionCreateEvent
- Record Components:
event
- the underlying jda eventkeyValueStore
- theKeyValueStore
belonging to this interaction over its whole lifetimedefinition
- theInteractionDefinition
defining this interaction (referring to the user defined method)arguments
- the arguments used to call the final user defined method viaInvokable.invoke(java.lang.Object, com.github.kaktushose.jda.commands.dispatching.context.InvocationContext)
- All Implemented Interfaces:
ErrorMessageFactory.ErrorContext
public record InvocationContext<T extends GenericInteractionCreateEvent>(T extends GenericInteractionCreateEvent event, @NotNull KeyValueStore keyValueStore, @NotNull InteractionDefinition definition, @NotNull SequencedCollection<Object> arguments)
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
ConstructorDescriptionInvocationContext
(T event, @NotNull KeyValueStore keyValueStore, @NotNull InteractionDefinition definition, @NotNull SequencedCollection<Object> arguments) Creates an instance of aInvocationContext
record class. -
Method Summary
Modifier and TypeMethodDescription@NotNull SequencedCollection
<Object> Returns the value of thearguments
record component.void
cancel
(@NotNull MessageCreateData errorMessage) Stops further execution of this invocation at the next suitable moment.@NotNull InteractionDefinition
Returns the value of thedefinition
record component.final boolean
Indicates whether some other object is "equal to" this one.event()
Returns the value of theevent
record component.final int
hashCode()
Returns a hash code value for this object.@NotNull KeyValueStore
Returns the value of thekeyValueStore
record component.final String
toString()
Returns a string representation of this record class.
-
Constructor Details
-
InvocationContext
public InvocationContext(@NotNull T event, @NotNull @NotNull KeyValueStore keyValueStore, @NotNull @NotNull InteractionDefinition definition, @NotNull @NotNull SequencedCollection<Object> arguments) Creates an instance of aInvocationContext
record class.- Parameters:
event
- the value for theevent
record componentkeyValueStore
- the value for thekeyValueStore
record componentdefinition
- the value for thedefinition
record componentarguments
- the value for thearguments
record component
-
-
Method Details
-
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
-
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 theevent
record component.- Specified by:
event
in interfaceErrorMessageFactory.ErrorContext
- Returns:
- the value of the
event
record component
-
keyValueStore
Returns the value of thekeyValueStore
record component.- Returns:
- the value of the
keyValueStore
record component
-
definition
Returns the value of thedefinition
record component.- Specified by:
definition
in interfaceErrorMessageFactory.ErrorContext
- Returns:
- the value of the
definition
record component
-
arguments
-