Class Helpers
java.lang.Object
com.github.kaktushose.jda.commands.internal.Helpers
Collection of helper methods that are used inside the framework.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidcheckDetached(IDetachableEntity entity, Class<?> origin) static voidcheckParameterType(MethodDescription method, int index, Class<?> type) Checks if the given parameter is present at theMethodat the given index.static voidcheckSignature(MethodDescription method, SequencedCollection<Class<?>> methodSignature) static voidcommandConfig(MethodBuildContext context) TheCommandDefinition.CommandConfigthat should be used when registering commands.errorContext(GenericInteractionCreateEvent event, InteractionDefinition definition) static StringhumanReadableType(OptionMapping optionMapping) Gets the human-readable representation of anOptionMapping.permissions(MethodBuildContext context) Extracts the permissions from aMethodBuildContext.replyConfig(Invokable definition, InteractionDefinition.ReplyConfig fallback) TheInteractionDefinition.ReplyConfigthat should be used when sending replies.
-
Constructor Details
-
Helpers
public Helpers()
-
-
Method Details
-
humanReadableType
Gets the human-readable representation of anOptionMapping.- Parameters:
optionMapping- theOptionMappingto return the human-readable representation for- Returns:
- the human-readable representation
-
permissions
Extracts the permissions from aMethodBuildContext. This combines the permissions of the method and the class.- Parameters:
context- theMethodBuildContextto extract the permissions from- Returns:
- a possibly-empty set of all permissions
-
checkParameterType
-
checkSignature
public static void checkSignature(MethodDescription method, SequencedCollection<Class<?>> methodSignature) -
checkSignatureUserContext
-
checkDetached
-
replyConfig
public static InteractionDefinition.ReplyConfig replyConfig(Invokable definition, InteractionDefinition.ReplyConfig fallback) TheInteractionDefinition.ReplyConfigthat should be used when sending replies.- Parameters:
definition- theinteraction definitionto build theInteractionDefinition.ReplyConfigfromfallback- theInteractionDefinition.ReplyConfigto use as a fallback- Implementation Note:
- This will first attempt to use the
ReplyConfigannotation of the method and then of the class. If neither is present will fall back to the globalInteractionDefinition.ReplyConfigprovided byJDACBuilder.
-
commandConfig
TheCommandDefinition.CommandConfigthat should be used when registering commands.- Parameters:
context- theMethodBuildContextto build theCommandDefinition.CommandConfigfrom- Implementation Note:
- This will first attempt to use the
CommandConfigannotation of the method and then of the class. If neither is present will fall back to the globalCommandDefinition.CommandConfigprovided byJDACBuilder.
-
errorContext
public static ErrorMessageFactory.ErrorContext errorContext(GenericInteractionCreateEvent event, InteractionDefinition definition)
-