Skip to content

Commit

Permalink
Close webhook client on shutdown
Browse files Browse the repository at this point in the history
  • Loading branch information
Erdragh committed Feb 7, 2025
1 parent ab19875 commit 315a57b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions common/src/main/kotlin/dev/erdragh/astralbot/Bot.kt
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ fun startAstralbot(server: MinecraftServer) {
fun stopAstralbot() {
LOGGER.info("Shutting down AstralBot")
shuttingDown.set(true)
minecraftHandler?.close()
if (baseDirectory != null) FAQHandler.stop()
if (jda != null) {
jda!!.shutdown()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -490,4 +490,8 @@ class MinecraftHandler(private val server: MinecraftServer) : ListenerAdapter()
private fun useWebhooks(): Boolean {
return AstralBotConfig.WEBHOOK_ENABLED.get() && webhookClient != null
}

fun close() {
webhookClient?.close()
}
}

0 comments on commit 315a57b

Please sign in to comment.