9 Commits
1.0.1 ... 1.3.0

Author SHA1 Message Date
semantic-release-bot
29a419a560 chore(release): 1.3.0 [skip ci]
# [1.3.0](https://git.tools.ldpt.fr/lucasdpt/spring-jda-starter/compare/1.2.0...1.3.0) (2025-12-17)

### Features

* add guild Id ([eddd857](eddd857a20))
2025-12-17 10:41:19 +00:00
lucasdpt
eddd857a20 feat: add guild Id
All checks were successful
Release / release (push) Successful in 1m58s
2025-12-17 11:40:46 +01:00
semantic-release-bot
7c74bd153e chore(release): 1.2.0 [skip ci]
# [1.2.0](https://git.tools.ldpt.fr/lucasdpt/spring-jda-starter/compare/1.1.0...1.2.0) (2025-12-16)

### Features

* bump ([0ce59fe](0ce59fead3))
2025-12-16 22:31:18 +00:00
0ce59fead3 feat: bump
All checks were successful
Release / release (push) Successful in 2m6s
2025-12-16 23:30:16 +01:00
74263537d5 feat!: bump to 4.0.0 Spring Boot
All checks were successful
Release / release (push) Successful in 25s
2025-12-16 23:28:53 +01:00
semantic-release-bot
78189e5c75 chore(release): 1.1.0 [skip ci]
# [1.1.0](https://git.tools.ldpt.fr/lucasdpt/spring-jda-starter/compare/1.0.2...1.1.0) (2025-12-15)

### Features

* add JdaAutoConfiguration.kt ([e7fdd19](e7fdd19928))
2025-12-15 14:21:26 +00:00
lucasdpt
e7fdd19928 feat: add JdaAutoConfiguration.kt
All checks were successful
Release / release (push) Successful in 2m7s
2025-12-15 15:20:49 +01:00
semantic-release-bot
be19485a25 chore(release): 1.0.2 [skip ci]
## [1.0.2](https://git.tools.ldpt.fr/lucasdpt/spring-jda-starter/compare/1.0.1...1.0.2) (2025-11-02)

### Bug Fixes

* fix pom ([4cc23b2](4cc23b2749))
2025-11-02 23:45:19 +00:00
lucasdpt
4cc23b2749 fix: fix pom
All checks were successful
Release / release (push) Successful in 1m58s
2025-11-03 00:44:49 +01:00
6 changed files with 91 additions and 9 deletions

View File

@@ -1,3 +1,31 @@
# [1.3.0](https://git.tools.ldpt.fr/lucasdpt/spring-jda-starter/compare/1.2.0...1.3.0) (2025-12-17)
### Features
* add guild Id ([eddd857](https://git.tools.ldpt.fr/lucasdpt/spring-jda-starter/commit/eddd857a205a2f17e7581bd6a278dc354191777b))
# [1.2.0](https://git.tools.ldpt.fr/lucasdpt/spring-jda-starter/compare/1.1.0...1.2.0) (2025-12-16)
### Features
* bump ([0ce59fe](https://git.tools.ldpt.fr/lucasdpt/spring-jda-starter/commit/0ce59fead3fe53d13efee8922cf726cfc4bed853))
# [1.1.0](https://git.tools.ldpt.fr/lucasdpt/spring-jda-starter/compare/1.0.2...1.1.0) (2025-12-15)
### Features
* add JdaAutoConfiguration.kt ([e7fdd19](https://git.tools.ldpt.fr/lucasdpt/spring-jda-starter/commit/e7fdd19928dbe20f0e71203cf4074c3ca5a9e667))
## [1.0.2](https://git.tools.ldpt.fr/lucasdpt/spring-jda-starter/compare/1.0.1...1.0.2) (2025-11-02)
### Bug Fixes
* fix pom ([4cc23b2](https://git.tools.ldpt.fr/lucasdpt/spring-jda-starter/commit/4cc23b27499c443ae4487489c98d78d87c9e4884))
## [1.0.1](https://git.tools.ldpt.fr/lucasdpt/spring-jda-starter/compare/1.0.0...1.0.1) (2025-11-02)

22
pom.xml
View File

@@ -5,11 +5,11 @@
<groupId>fr.lucasdupont</groupId>
<artifactId>spring-jda-starter</artifactId>
<version>1.0.1</version>
<version>1.3.0</version>
<properties>
<java.version>21</java.version>
<spring.boot.version>3.5.7</spring.boot.version>
<spring.boot.version>4.0.0</spring.boot.version>
<kotlin.version>2.2.0</kotlin.version>
<jda.version>6.1.1</jda.version>
</properties>
@@ -38,6 +38,11 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-reflect</artifactId>
@@ -66,10 +71,23 @@
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>${spring.boot.version}</version>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
<plugin>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-maven-plugin</artifactId>
<version>${kotlin.version}</version>
<executions>
<execution>
<id>compile</id>
<goals>
<goal>compile</goal>
</goals>
</execution>
</executions>
<configuration>
<args>
<arg>-Xjsr305=strict</arg>

View File

@@ -0,0 +1,30 @@
package fr.lucasdupont.configuration
import fr.lucasdupont.service.JdaService
import org.springframework.boot.autoconfigure.AutoConfiguration
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty
import org.springframework.boot.context.properties.EnableConfigurationProperties
import org.springframework.context.ApplicationContext
import org.springframework.context.ApplicationEventPublisher
import org.springframework.context.annotation.Bean
import org.springframework.context.annotation.ComponentScan
@AutoConfiguration
@EnableConfigurationProperties(JdaConfiguration::class)
@ConditionalOnProperty(prefix = "jda", name = ["token"])
@ComponentScan(basePackages = ["fr.lucasdupont"])
class JdaAutoConfiguration {
@Bean
@ConditionalOnMissingBean
fun jdaService(
applicationContext: ApplicationContext,
jdaConfiguration: JdaConfiguration,
publisher: ApplicationEventPublisher
): JdaService {
return JdaService(applicationContext, jdaConfiguration, publisher)
}
}

View File

@@ -10,4 +10,5 @@ class JdaConfiguration {
var onlineStatus: OnlineStatus = OnlineStatus.ONLINE
var cacheFlags: Set<CacheFlag> = emptySet()
var activity: String? = null
var guildId: String? = null
}

View File

@@ -11,15 +11,11 @@ import net.dv8tion.jda.api.events.interaction.command.SlashCommandInteractionEve
import net.dv8tion.jda.api.hooks.ListenerAdapter
import net.dv8tion.jda.api.requests.GatewayIntent
import net.dv8tion.jda.api.utils.cache.CacheFlag
import org.springframework.boot.context.properties.EnableConfigurationProperties
import org.springframework.context.ApplicationContext
import org.springframework.context.ApplicationEventPublisher
import org.springframework.context.PayloadApplicationEvent
import org.springframework.context.event.EventListener
import org.springframework.stereotype.Service
@Service
@EnableConfigurationProperties(JdaConfiguration::class)
class JdaService(
applicationContext: ApplicationContext,
jdaConfiguration: JdaConfiguration,
@@ -59,9 +55,16 @@ class JdaService(
val commandDataList = contextCommands.map { it.toCommandData() }
jda.updateCommands()
.addCommands(commandDataList)
.queue()
if (jdaConfiguration.guildId != null) {
jda.getGuildById(jdaConfiguration.guildId!!)
?.updateCommands()
?.addCommands(commandDataList)
?.queue()
} else {
jda.updateCommands()
.addCommands(commandDataList)
.queue()
}
}
@EventListener(SlashCommandInteractionEvent::class)

View File

@@ -0,0 +1,2 @@
fr.lucasdupont.configuration.JdaAutoConfiguration