EnableBotCommands

@ConfigurationPropertiesScan(basePackageClasses = [JDAConfiguration::class, BotCommandsCoreConfiguration::class])
@EnableAutoConfiguration
annotation class EnableBotCommands(source)

Deprecated

Replaced with autoconfiguration

Entry point annotation for Spring projects.

This annotation can only be used once in your main class.

The only requirement for a basic bot is a service extending JDAService, learn more on the wiki.

Usage with BotCommands annotations

While this enables support for Spring-managed instances to be used in the application, some classes may still require usage of specific annotations, such as @Command or @Resolver, but are @Component specializations, and thus Spring beans.

Component scanning

Your main class must not use @ComponentScan directly, prefer using your own annotation meta-annotated with the scanner, for example:

@ComponentScan("my.bot.package")
annotation class EnableMyBot

@EnableMyBot
@EnableBotCommands
@EnableAutoConfiguration
@ConfigurationPropertiesScan
class MyBotApplication

This is due to this issue:

The recommendation is that you either declare one or more local `@ComponentScan` annotations OR one or more `@ComponentScan` meta-annotations.
If you combine local and meta-annotations for `@ComponentScan`, only the local `@ComponentScan` annotations will be honored.

If you have a better solution, please suggest it.

Configuration

Most of it can be done using Spring properties, you can see the property names on each configuration.

If you want to do it using code, or need to configure something not available using properties, you can use the configurer interfaces:

There are additionally a few options you can set in JDAConfiguration, for convenient use in your JDAService.