mirror of
https://github.com/InsanusMokrassar/PlaguBot.git
synced 2024-11-24 16:38:42 +00:00
commit
451b2bbc39
@ -1,5 +1,13 @@
|
||||
# Changelog
|
||||
|
||||
## 7.4.2
|
||||
|
||||
* `Versions`:
|
||||
* `Kotlin`: `1.9.22`
|
||||
* `tgbotapi`: `9.4.3`
|
||||
* `MicroUtils`: `0.20.23`
|
||||
* `Koin`: `3.5.7`
|
||||
|
||||
## 7.4.1
|
||||
|
||||
* `Versions`:
|
||||
|
@ -8,6 +8,7 @@ import dev.inmo.micro_utils.fsm.common.StatesManager
|
||||
import dev.inmo.micro_utils.fsm.common.managers.*
|
||||
import dev.inmo.micro_utils.koin.getAllDistinct
|
||||
import dev.inmo.plagubot.config.*
|
||||
import dev.inmo.tgbotapi.bot.ktor.KtorRequestsExecutorBuilder
|
||||
import dev.inmo.tgbotapi.bot.ktor.telegramBot
|
||||
import dev.inmo.tgbotapi.extensions.api.webhook.deleteWebhook
|
||||
import dev.inmo.tgbotapi.extensions.behaviour_builder.*
|
||||
@ -37,7 +38,20 @@ data class PlaguBot(
|
||||
private val config: Config
|
||||
) : Plugin {
|
||||
@Transient
|
||||
private val bot = telegramBot(config.botToken)
|
||||
private val bot = telegramBot(
|
||||
token = config.botToken,
|
||||
apiUrl = config.botApiServer
|
||||
) {
|
||||
setupBotClient()
|
||||
}
|
||||
|
||||
override fun KtorRequestsExecutorBuilder.setupBotClient() {
|
||||
config.plugins.forEach {
|
||||
with(it) {
|
||||
setupBotClient()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun Module.setupDI(database: Database, params: JsonObject) {
|
||||
single { config }
|
||||
|
@ -2,6 +2,7 @@ package dev.inmo.plagubot.config
|
||||
|
||||
import dev.inmo.micro_utils.common.Warning
|
||||
import dev.inmo.plagubot.Plugin
|
||||
import dev.inmo.tgbotapi.utils.telegramBotAPIDefaultUrl
|
||||
import kotlinx.serialization.SerialName
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
@ -12,4 +13,5 @@ data class Config(
|
||||
val plugins: List<Plugin>,
|
||||
@SerialName("database")
|
||||
val databaseConfig: DatabaseConfig = DatabaseConfig(),
|
||||
val botApiServer: String = telegramBotAPIDefaultUrl
|
||||
)
|
||||
|
@ -5,4 +5,4 @@ kotlin.js.generate.externals=true
|
||||
kotlin.incremental=true
|
||||
|
||||
group=dev.inmo
|
||||
version=7.4.1
|
||||
version=7.4.2
|
||||
|
@ -1,13 +1,13 @@
|
||||
[versions]
|
||||
|
||||
kt = "1.9.21"
|
||||
kt = "1.9.22"
|
||||
kt-serialization = "1.6.2"
|
||||
kt-coroutines = "1.7.3"
|
||||
|
||||
microutils = "0.20.19"
|
||||
tgbotapi = "9.4.2"
|
||||
microutils = "0.20.23"
|
||||
tgbotapi = "9.4.3"
|
||||
|
||||
ksp = "1.9.21-1.0.15"
|
||||
ksp = "1.9.21-1.0.16"
|
||||
|
||||
jb-exposed = "0.45.0"
|
||||
jb-dokka = "1.9.10"
|
||||
@ -21,7 +21,7 @@ ktor = "2.3.7"
|
||||
|
||||
gh-release = "2.4.1"
|
||||
|
||||
koin = "3.5.0"
|
||||
koin = "3.5.3"
|
||||
|
||||
[libraries]
|
||||
|
||||
|
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
@ -1,5 +1,5 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
|
@ -1,6 +1,7 @@
|
||||
package dev.inmo.plagubot
|
||||
|
||||
import dev.inmo.micro_utils.fsm.common.State
|
||||
import dev.inmo.tgbotapi.bot.ktor.KtorRequestsExecutorBuilder
|
||||
import dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContext
|
||||
import dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextWithFSM
|
||||
import kotlinx.serialization.Serializable
|
||||
@ -18,6 +19,8 @@ import org.koin.core.module.Module
|
||||
*/
|
||||
@Serializable(PluginSerializer::class)
|
||||
interface Plugin {
|
||||
fun KtorRequestsExecutorBuilder.setupBotClient() {}
|
||||
|
||||
/**
|
||||
* This method will be called when this plugin should configure di module based on the incoming params
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user