Interface InteractionDefinition
- All Superinterfaces:
Definition
,com.github.kaktushose.jda.commands.definitions.features.internal.Invokable
- All Known Subinterfaces:
CommandDefinition
,ComponentDefinition<T>
,SelectMenuDefinition<T>
- All Known Implementing Classes:
AutoCompleteDefinition
,ButtonDefinition
,ContextCommandDefinition
,EntitySelectMenuDefinition
,ModalDefinition
,SlashCommandDefinition
,StringSelectMenuDefinition
public sealed interface InteractionDefinition
extends Definition, com.github.kaktushose.jda.commands.definitions.features.internal.Invokable
permits AutoCompleteDefinition, ModalDefinition, CommandDefinition, ComponentDefinition<T>
Common interface for all definitions that represent an interaction.
- See Also:
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic final record
Stores the configuration values for sending replies. -
Field Summary
Fields inherited from interface com.github.kaktushose.jda.commands.definitions.features.internal.Invokable
log
-
Method Summary
Modifier and TypeMethodDescriptiondefault @NotNull String
The id for this definition.default Object
Creates a new instance of theInteraction
class.@NotNull Collection
<String> A possibly-emptyCollection
of permissions for this interaction.default @NotNull InteractionDefinition.ReplyConfig
replyConfig
(@NotNull InteractionDefinition.ReplyConfig globalFallback) TheInteractionDefinition.ReplyConfig
that should be used when sending replies.Methods inherited from interface com.github.kaktushose.jda.commands.definitions.Definition
displayName
Methods inherited from interface com.github.kaktushose.jda.commands.definitions.features.internal.Invokable
clazzDescription, invoke, methodDescription
-
Method Details
-
definitionId
The id for this definition. For interaction definition this is the hash code of the full class name and method name combined.- Specified by:
definitionId
in interfaceDefinition
-
newInstance
@Internal default Object newInstance() throws InvocationTargetException, InstantiationException, IllegalAccessExceptionCreates a new instance of theInteraction
class.- Returns:
- a new instance of the declaring class of the method this definition is bound to.
- Throws:
InvocationTargetException
- if the object creation failsInstantiationException
- if the object creation failsIllegalAccessException
- if the object creation fails
-
permissions
A possibly-emptyCollection
of permissions for this interaction.- API Note:
- The
PermissionsMiddleware
will validate the provided permissions.
-
replyConfig
@NotNull default @NotNull InteractionDefinition.ReplyConfig replyConfig(@NotNull @NotNull InteractionDefinition.ReplyConfig globalFallback) TheInteractionDefinition.ReplyConfig
that should be used when sending replies.- Implementation Note:
- This will first attempt to use the
ReplyConfig
annotation of the method and then of the class. If neither is present will fall back to the globalInteractionDefinition.ReplyConfig
provided byJDACommandsBuilder
-