setupBotPlugin now works synchronously

This commit is contained in:
InsanusMokrassar 2023-02-12 01:29:45 +06:00
parent 328a8b215c
commit 3592a5907c
2 changed files with 12 additions and 12 deletions

View File

@ -2,6 +2,8 @@
## 3.4.1 ## 3.4.1
* `setupBotPlugin` now works synchronously
## 3.4.0 ## 3.4.0
* `Versions`: * `Versions`:

View File

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