Class JDACommandsBuilder
java.lang.Object
com.github.kaktushose.jda.commands.JDACommandsBuilder
This builder is used to build instances of JDACommands
.
Please note that values that can be set have a default implementation; These default implementations are sometimes bases on reflections. If you want to avoid reflections, you have to provide your own implementations for:
descriptor(com.github.kaktushose.jda.commands.definitions.description.Descriptor)
classFinders(ClassFinder...)
dependencyInjector(DependencyInjector)
Example
JDACommands jdaCommands = JDACommands.builder(jda, Main.class)
.middleware(Priority.NORMAL, new TestMiddleware())
.globalReplyConfig(new InteractionDefinition.ReplyConfig(false, false, true))
.classFinders(ClassFinder.reflective(Main.class), ClassFinders.explicit(ButtonInteraction.class))
.start();
-
Method Summary
Modifier and TypeMethodDescription@NotNull JDACommandsBuilder
adapter
(@NotNull Class<?> type, @NotNull TypeAdapter<?> adapter) @NotNull JDACommandsBuilder
classFinders
(@NotNull ClassFinder... classFinders) @NotNull JDACommandsBuilder
dependencyInjector
(@NotNull DependencyInjector dependencyInjector) @NotNull JDACommandsBuilder
descriptor
(@NotNull Descriptor descriptor) @NotNull JDACommandsBuilder
errorMessageFactory
(@NotNull ErrorMessageFactory errorMessageFactory) @NotNull JDACommandsBuilder
expirationStrategy
(@NotNull ExpirationStrategy expirationStrategy) @NotNull JDACommandsBuilder
globalReplyConfig
(@NotNull InteractionDefinition.ReplyConfig globalReplyConfig) @NotNull JDACommandsBuilder
guildScopeProvider
(@NotNull GuildScopeProvider guildScopeProvider) @NotNull JDACommandsBuilder
localizationFunction
(@NotNull LocalizationFunction localizationFunction) @NotNull JDACommandsBuilder
middleware
(@NotNull Priority priority, @NotNull Middleware middleware) @NotNull JDACommandsBuilder
permissionsProvider
(@NotNull PermissionsProvider permissionsProvider) @NotNull JDACommands
start()
This method instantiates an instance ofJDACommands
and starts the framework.@NotNull JDACommandsBuilder
validator
(@NotNull Class<? extends Annotation> annotation, @NotNull Validator validator)
-
Method Details
-
classFinders
@NotNull public @NotNull JDACommandsBuilder classFinders(@NotNull @NotNull ClassFinder... classFinders) - Parameters:
classFinders
- the to be usedClassFinder
s- API Note:
- This method overrides the underlying collection instead of adding to it.
If you want to add own
ClassFinder
s while keeping the default reflective implementation, you have to add it explicitly viaClassFinder.reflective(Class, String...)
too.
-
descriptor
- Parameters:
descriptor
- theDescriptor
to be used
-
localizationFunction
@NotNull public @NotNull JDACommandsBuilder localizationFunction(@NotNull @NotNull LocalizationFunction localizationFunction) - Parameters:
localizationFunction
- TheLocalizationFunction
to be used to localize interactions
-
dependencyInjector
@NotNull public @NotNull JDACommandsBuilder dependencyInjector(@NotNull @NotNull DependencyInjector dependencyInjector) - Parameters:
dependencyInjector
- TheDependencyInjector
that should be used to instantiate instances of the user defined InteractionsInteraction
-
expirationStrategy
@NotNull public @NotNull JDACommandsBuilder expirationStrategy(@NotNull @NotNull ExpirationStrategy expirationStrategy) - Parameters:
expirationStrategy
- TheExpirationStrategy
to be used
-
middleware
@NotNull public @NotNull JDACommandsBuilder middleware(@NotNull @NotNull Priority priority, @NotNull @NotNull Middleware middleware) - Parameters:
priority
- ThePriority
with what theMiddleware
should be registeredmiddleware
- The to be registeredMiddleware
-
adapter
@NotNull public @NotNull JDACommandsBuilder adapter(@NotNull @NotNull Class<?> type, @NotNull @NotNull TypeAdapter<?> adapter) - Parameters:
type
- The type that the givenTypeAdapter
can handleadapter
- TheTypeAdapter
to be registered
-
validator
@NotNull public @NotNull JDACommandsBuilder validator(@NotNull @NotNull Class<? extends Annotation> annotation, @NotNull @NotNull Validator validator) -
permissionsProvider
@NotNull public @NotNull JDACommandsBuilder permissionsProvider(@NotNull @NotNull PermissionsProvider permissionsProvider) - Parameters:
permissionsProvider
- ThePermissionsProvider
that should be used
-
errorMessageFactory
@NotNull public @NotNull JDACommandsBuilder errorMessageFactory(@NotNull @NotNull ErrorMessageFactory errorMessageFactory) - Parameters:
errorMessageFactory
- TheErrorMessageFactory
that should be used
-
guildScopeProvider
@NotNull public @NotNull JDACommandsBuilder guildScopeProvider(@NotNull @NotNull GuildScopeProvider guildScopeProvider) - Parameters:
guildScopeProvider
- TheGuildScopeProvider
that should be used
-
globalReplyConfig
@NotNull public @NotNull JDACommandsBuilder globalReplyConfig(@NotNull @NotNull InteractionDefinition.ReplyConfig globalReplyConfig) - Parameters:
globalReplyConfig
- theInteractionDefinition.ReplyConfig
to be used as a global fallback option
-
start
This method instantiates an instance ofJDACommands
and starts the framework.
-