updates in dependencies and update bot setup logic

This commit is contained in:
InsanusMokrassar 2022-05-21 15:52:37 +06:00
parent 492c04e25f
commit a3f59087e0
3 changed files with 21 additions and 9 deletions

View File

@ -2,6 +2,12 @@
## 1.0.1 ## 1.0.1
* `Versions`
* `tgbotapi`: `1.1.3`
* `microutils`: `0.10.5`
* `Plugin`:
* All plugins will be loaded in parallel
## 1.0.0 ## 1.0.0
* `Versions` * `Versions`

View File

@ -1,5 +1,6 @@
package dev.inmo.plagubot package dev.inmo.plagubot
import dev.inmo.micro_utils.coroutines.runCatchingSafely
import dev.inmo.plagubot.config.* import dev.inmo.plagubot.config.*
import dev.inmo.tgbotapi.bot.ktor.telegramBot import dev.inmo.tgbotapi.bot.ktor.telegramBot
import dev.inmo.tgbotapi.extensions.api.webhook.deleteWebhook import dev.inmo.tgbotapi.extensions.api.webhook.deleteWebhook
@ -56,15 +57,20 @@ data class PlaguBot(
} }
override suspend fun BehaviourContext.setupBotPlugin(koin: Koin) { override suspend fun BehaviourContext.setupBotPlugin(koin: Koin) {
config.plugins.forEach { config.plugins.map {
runCatching { launch {
with(it) { runCatchingSafely {
setupBotPlugin(koin) logger.info("Start loading of $it")
with(it) {
setupBotPlugin(koin)
}
}.onFailure { e ->
logger.log(Level.WARNING, "Unable to load bot part of $it", e)
}.onSuccess {
logger.info("Complete loading of $it")
} }
}.onFailure { e ->
logger.log(Level.WARNING, "Unable to load bot part of $it", e)
} }
} }.joinAll()
} }
/** /**

View File

@ -4,8 +4,8 @@ kt = "1.6.21"
kt-serialization = "1.3.3" kt-serialization = "1.3.3"
kt-coroutines = "1.6.1" kt-coroutines = "1.6.1"
microutils = "0.10.4" microutils = "0.10.5"
tgbotapi = "1.1.0" tgbotapi = "1.1.3"
jb-exposed = "0.38.2" jb-exposed = "0.38.2"
jb-dokka = "1.6.21" jb-dokka = "1.6.21"