Skip to content

Commit

Permalink
setupBotPlugin now works synchronously
Browse files Browse the repository at this point in the history
  • Loading branch information
InsanusMokrassar committed Feb 11, 2023
1 parent 328a8b2 commit 3592a59
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

## 3.4.1

* `setupBotPlugin` now works synchronously

## 3.4.0

* `Versions`:
Expand Down
22 changes: 10 additions & 12 deletions bot/src/main/kotlin/dev/inmo/plagubot/PlaguBot.kt
Original file line number Diff line number Diff line change
Expand Up @@ -63,20 +63,18 @@ data class PlaguBot(
}

override suspend fun BehaviourContextWithFSM<State>.setupBotPlugin(koin: Koin) {
config.plugins.map { plugin ->
launch {
runCatchingSafely {
logger.i("Start loading of $plugin")
with(plugin) {
setupBotPlugin(koin)
}
}.onFailure { e ->
logger.w("Unable to load bot part of $plugin", e)
}.onSuccess {
logger.i("Complete loading of $plugin")
config.plugins.forEach { plugin ->
runCatchingSafely {
logger.i("Start loading of $plugin")
with(plugin) {
setupBotPlugin(koin)
}
}.onFailure { e ->
logger.w("Unable to load bot part of $plugin", e)
}.onSuccess {
logger.i("Complete loading of $plugin")
}
}.joinAll()
}
}

/**
Expand Down

0 comments on commit 3592a59

Please sign in to comment.