From 3592a5907cf152b91300784175c26e2dc9a5b7d2 Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Sun, 12 Feb 2023 01:29:45 +0600 Subject: [PATCH] setupBotPlugin now works synchronously --- CHANGELOG.md | 2 ++ .../main/kotlin/dev/inmo/plagubot/PlaguBot.kt | 22 +++++++++---------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 14538eb..4156d9e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ ## 3.4.1 +* `setupBotPlugin` now works synchronously + ## 3.4.0 * `Versions`: diff --git a/bot/src/main/kotlin/dev/inmo/plagubot/PlaguBot.kt b/bot/src/main/kotlin/dev/inmo/plagubot/PlaguBot.kt index 5cec546..4b0cf7c 100644 --- a/bot/src/main/kotlin/dev/inmo/plagubot/PlaguBot.kt +++ b/bot/src/main/kotlin/dev/inmo/plagubot/PlaguBot.kt @@ -63,20 +63,18 @@ data class PlaguBot( } override suspend fun BehaviourContextWithFSM.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() + } } /**