Compare commits

...

36 Commits

Author SHA1 Message Date
InsanusMokrassar 8bd80c1c0c
Merge pull request #97 from InsanusMokrassar/8.3.0
8.3.0
2024-04-23 18:50:57 +06:00
InsanusMokrassar 2234ffd55d update gradle wrapper 2024-04-23 18:44:51 +06:00
InsanusMokrassar 1a9d8b0d5e update dependencies 2024-04-23 18:44:26 +06:00
InsanusMokrassar e00f40d06a start 8.3.0 2024-04-23 18:37:33 +06:00
InsanusMokrassar 9883d2b3b1
Merge pull request #96 from InsanusMokrassar/8.2.0
8.2.0
2024-02-18 21:34:04 +06:00
InsanusMokrassar bdfd3b816c update dependencies 2024-02-18 21:31:45 +06:00
InsanusMokrassar dd37ae0f2f start 8.2.0 2024-02-18 21:27:22 +06:00
InsanusMokrassar 8efe977e76
Merge pull request #95 from InsanusMokrassar/8.1.1
8.1.1
2024-02-10 23:45:26 +06:00
InsanusMokrassar 8290a68654 update dependencies 2024-02-10 23:44:52 +06:00
InsanusMokrassar 493a18a0f7 start 8.1.1 2024-02-10 23:41:36 +06:00
InsanusMokrassar 36608937af
Merge pull request #94 from InsanusMokrassar/8.1.0
8.1.0
2024-01-14 18:42:36 +06:00
InsanusMokrassar 1b1b069d93 integrate startup launcher 2024-01-14 18:33:41 +06:00
InsanusMokrassar 37b5b8e867 start 8.1.0 2024-01-14 18:21:26 +06:00
InsanusMokrassar 468310c819
Merge pull request #93 from InsanusMokrassar/8.0.0
8.0.0
2024-01-12 20:28:24 +06:00
InsanusMokrassar 0d27a4f6f7 update dependencies 2024-01-12 20:12:58 +06:00
InsanusMokrassar f9d131866f start 8.0.0 2024-01-12 20:11:29 +06:00
InsanusMokrassar 451b2bbc39
Merge pull request #92 from InsanusMokrassar/7.4.2
7.4.2
2023-12-24 23:25:42 +06:00
InsanusMokrassar d51e2d8e7c fix of #90 and #91 2023-12-24 23:24:04 +06:00
InsanusMokrassar 6c45a8c848 update dependencies 2023-12-24 23:17:29 +06:00
InsanusMokrassar 8a7e05580d start 7.4.2 2023-12-24 23:14:24 +06:00
InsanusMokrassar 8b78f2901f
Merge pull request #89 from InsanusMokrassar/7.4.1
7.4.1
2023-12-10 14:47:39 +06:00
InsanusMokrassar cad8743ced update dependencies and fill changelog 2023-12-10 14:46:13 +06:00
InsanusMokrassar 8f827e9f79 start 7.4.1 2023-12-10 14:34:52 +06:00
InsanusMokrassar 28039df992
Merge pull request #88 from InsanusMokrassar/7.4.0
7.4.0
2023-11-26 20:56:04 +06:00
InsanusMokrassar 18019c37ea remove expicit KSLog dependency 2023-11-26 19:29:29 +06:00
InsanusMokrassar 8a84f65a12
Update CHANGELOG.md 2023-11-26 19:02:00 +06:00
InsanusMokrassar 49f30ab939
Update libs.versions.toml 2023-11-26 18:52:26 +06:00
InsanusMokrassar 8a15deceb8
Update gradle.properties 2023-11-26 18:49:43 +06:00
InsanusMokrassar ea3273c4cf
Merge pull request #87 from InsanusMokrassar/7.3.0
7.3.0
2023-11-06 15:17:37 +06:00
InsanusMokrassar 439972e783 update dependencies 2023-11-05 20:52:30 +06:00
InsanusMokrassar 08907291c5 update dependencies 2023-11-05 19:34:43 +06:00
InsanusMokrassar 0f4819a83d start 7.3.0 2023-11-05 19:14:12 +06:00
InsanusMokrassar 7abdf18491
Merge pull request #86 from InsanusMokrassar/7.2.3
7.2.3
2023-10-11 15:31:46 +06:00
InsanusMokrassar 98a91ea357 update dependencies 2023-10-11 15:29:44 +06:00
InsanusMokrassar 934f603a8a 7.2.3 2023-10-11 15:23:23 +06:00
InsanusMokrassar 76e9cdae8d
Merge pull request #85 from InsanusMokrassar/7.2.2
7.2.2
2023-10-01 15:59:58 +06:00
17 changed files with 235 additions and 78 deletions

View File

@ -8,9 +8,9 @@ jobs:
steps:
- uses: actions/checkout@v2
- name: Set up JDK 11
- name: Set up JDK 17
uses: actions/setup-java@v1
with:
java-version: 11
java-version: 17
- name: Build with Gradle
run: ./gradlew build

View File

@ -1,5 +1,77 @@
# Changelog
## 8.3.0
* `Versions`:
* `Serialization`: `1.6.3`
* `MicroUtils`: `0.20.45`
* `tgbotapi`: `12.0.1`
* `Exposed`: `0.49.0`
* `SQLite`: `3.45.3.0`
* `Koin`: `3.5.6`
## 8.2.0
* `Versions`:
* `Coroutines`: `1.8.0`
* `tgbotapi`: `10.1.0`
* `MicroUtils`: `0.20.35`
## 8.1.1
* `Versions`:
* `tgbotapi`: `10.0.1`
* `MicroUtils`: `0.20.32`
* `Exposed`: `0.47.0`
## 8.1.0
* Integrate `dev.inmo:micro_utils.startup` into project
## 8.0.0
* `Versions`:
* `tgbotapi`: `10.0.0`
* `MicroUtils`: `0.20.26`
* `Exposed`: `0.46.0`
## 7.4.2
* `Versions`:
* `Kotlin`: `1.9.22`
* `tgbotapi`: `9.4.3`
* `MicroUtils`: `0.20.23`
* `Koin`: `3.5.7`
## 7.4.1
* `Versions`:
* `Serialization`: `1.6.2`
* `tgbotapi`: `9.4.2`
* `Exposed`: `0.45.0`
* `SQLite`: `3.44.1.0`
* `MicroUtils`: `0.20.19`
* `uuid`: `0.8.2`
* `ktor`: `2.3.7`
## 7.3.0
* `Versions`:
* `Kotlin`: `1.9.21`
* `Serialization`: `1.6.1`
* `tgbotapi`: `9.4.1`
* `ktor`: `2.3.6`
* `KSLog`: Removed explicit dependency, now it is declared in tgbotapi
* `MicroUtils`: `0.20.15`
## 7.2.3
* `Versions`:
* `tgbotapi`: `9.2.2`
* `exposed`: `0.44.0`
* `koin`: `3.5.0`
* `ktor`: `2.3.5`
## 7.2.2
* `Bot`:

View File

@ -20,7 +20,7 @@ dependencies {
api libs.tgbotapi.behaviourBuilder.fsm
api libs.microutils.repos.exposed
api libs.microutils.koin
api libs.kslog
api libs.microutils.startup.launcher
api libs.sqlite
@ -34,8 +34,8 @@ application {
}
java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
ksp { // this generator do not require any arguments and we should left `ksp` empty

View File

@ -2,11 +2,11 @@ apply plugin: 'maven-publish'
task javadocJar(type: Jar) {
from javadoc
classifier = 'javadoc'
archiveClassifier = 'javadoc'
}
task sourcesJar(type: Jar) {
from sourceSets.main.allSource
classifier = 'sources'
archiveClassifier = 'sources'
}
publishing {
@ -49,18 +49,14 @@ publishing {
}
}
repositories {
if (project.hasProperty('GITEA_TOKEN') || System.getenv('GITEA_TOKEN') != null) {
if ((project.hasProperty('INMONEXUS_USER') || System.getenv('INMONEXUS_USER') != null) && (project.hasProperty('INMONEXUS_PASSWORD') || System.getenv('INMONEXUS_PASSWORD') != null)) {
maven {
name = "Gitea"
url = uri("https://git.inmo.dev/api/packages/InsanusMokrassar/maven")
name = "InmoNexus"
url = uri("https://nexus.inmo.dev/repository/maven-releases/")
credentials(HttpHeaderCredentials) {
name = "Authorization"
value = project.hasProperty('GITEA_TOKEN') ? project.property('GITEA_TOKEN') : System.getenv('GITEA_TOKEN')
}
authentication {
header(HttpHeaderAuthentication)
credentials {
username = project.hasProperty('INMONEXUS_USER') ? project.property('INMONEXUS_USER') : System.getenv('INMONEXUS_USER')
password = project.hasProperty('INMONEXUS_PASSWORD') ? project.property('INMONEXUS_PASSWORD') : System.getenv('INMONEXUS_PASSWORD')
}
}
@ -96,4 +92,27 @@ if (project.hasProperty("signing.gnupg.keyName")) {
dependsOn(it)
}
}
// Workaround to make android sign operations depend on signing tasks
project.getTasks().withType(AbstractPublishToMaven.class).configureEach {
def signingTasks = project.getTasks().withType(Sign.class)
mustRunAfter(signingTasks)
}
// Workaround to make test tasks use sign
project.getTasks().withType(Sign.class).configureEach { signTask ->
def withoutSign = (signTask.name.startsWith("sign") ? signTask.name.minus("sign") : signTask.name)
def pubName = withoutSign.endsWith("Publication") ? withoutSign.substring(0, withoutSign.length() - "Publication".length()) : withoutSign
// These tasks only exist for native targets, hence findByName() to avoid trying to find them for other targets
// Task ':linkDebugTest<platform>' uses this output of task ':sign<platform>Publication' without declaring an explicit or implicit dependency
def debugTestTask = tasks.findByName("linkDebugTest$pubName")
if (debugTestTask != null) {
signTask.mustRunAfter(debugTestTask)
}
// Task ':compileTestKotlin<platform>' uses this output of task ':sign<platform>Publication' without declaring an explicit or implicit dependency
def testTask = tasks.findByName("compileTestKotlin$pubName")
if (testTask != null) {
signTask.mustRunAfter(testTask)
}
}
}

View File

@ -1 +1 @@
{"licenses":[{"id":"Apache-2.0","title":"Apache Software License 2.0","url":"https://github.com/InsanusMokrassar/PlaguBot/LICENSE"}],"mavenConfig":{"name":"PlaguBot Bot","description":"Base PlaguBot project","url":"https://github.com/InsanusMokrassar/PlaguBot","vcsUrl":"ssh://git@github.com/InsanusMokrassar/PlaguBot.git","developers":[{"id":"InsanusMokrassar","name":"Aleksei Ovsiannikov","eMail":"ovsyannikov.alexey95@gmail.com"}],"repositories":[{"name":"Gitea","url":"https://git.inmo.dev/api/packages/InsanusMokrassar/maven","credsType":{"type":"dev.inmo.kmppscriptbuilder.core.models.MavenPublishingRepository.CredentialsType.HttpHeaderCredentials","headerName":"Authorization","headerValueProperty":"GITEA_TOKEN"}},{"name":"sonatype","url":"https://oss.sonatype.org/service/local/staging/deploy/maven2/"}],"gpgSigning":{"type":"dev.inmo.kmppscriptbuilder.core.models.GpgSigning.Optional"}},"type":"JVM"}
{"licenses":[{"id":"Apache-2.0","title":"Apache Software License 2.0","url":"https://github.com/InsanusMokrassar/PlaguBot/LICENSE"}],"mavenConfig":{"name":"PlaguBot Bot","description":"Base PlaguBot project","url":"https://github.com/InsanusMokrassar/PlaguBot","vcsUrl":"ssh://git@github.com/InsanusMokrassar/PlaguBot.git","developers":[{"id":"InsanusMokrassar","name":"Aleksei Ovsiannikov","eMail":"ovsyannikov.alexey95@gmail.com"}],"repositories":[{"name":"InmoNexus","url":"https://nexus.inmo.dev/repository/maven-releases/"},{"name":"sonatype","url":"https://oss.sonatype.org/service/local/staging/deploy/maven2/"}],"gpgSigning":{"type":"dev.inmo.kmppscriptbuilder.core.models.GpgSigning.Optional"}},"type":"JVM"}

View File

@ -32,8 +32,6 @@ object HelloPlugin : Plugin {
override fun Module.setupDI(database: Database, params: JsonObject) {
single {
get<Json>().decodeFromJsonElement(HelloPluginConfig.serializer(), params["helloPlugin"] ?: return@single null)
}
}
@ -43,6 +41,11 @@ object HelloPlugin : Plugin {
data class SaidHelloOnce(override val context: IdChatIdentifier) : InternalFSMState
}
override suspend fun startPlugin(koin: Koin) {
super.startPlugin(koin)
logger.i { "This logic called BEFORE the bot will be started and setup" }
}
override suspend fun BehaviourContextWithFSM<State>.setupBotPlugin(koin: Koin) {
val toPrint = koin.getOrNull<HelloPluginConfig>() ?.print ?: "Hello :)"
logger.d { toPrint }

View File

@ -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,19 +38,36 @@ 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 Module.setupDI(database: Database, params: JsonObject) {
single { config }
single { config.plugins }
single { config.databaseConfig }
single { config.databaseConfig.database }
override fun KtorRequestsExecutorBuilder.setupBotClient() {
config.botPlugins.forEach {
with(it) {
setupBotClient()
}
}
}
override fun Module.setupDI(config: JsonObject) {
single { this@PlaguBot.config }
single { this@PlaguBot.config.plugins }
single { this@PlaguBot.config.databaseConfig }
single { this@PlaguBot.config.databaseConfig.database }
single { defaultJsonFormat }
single { this@PlaguBot }
single { bot }
}
override fun Module.setupDI(database: Database, params: JsonObject) {
setupDI(params)
includes(
config.plugins.mapNotNull {
config.botPlugins.mapNotNull {
runCatching {
module {
with(it) {
@ -57,14 +75,31 @@ data class PlaguBot(
}
}
}.onFailure { e ->
logger.w("Unable to load DI part of $it", e)
logger.w(e) { "Unable to load DI part of $it" }
}.getOrNull()
}
)
}
override suspend fun BehaviourContextWithFSM<State>.setupBotPlugin(koin: Koin) {
override suspend fun startPlugin(koin: Koin) {
super.startPlugin(koin)
config.plugins.forEach { plugin ->
runCatchingSafely {
logger.i { "Starting of $plugin common logic" }
with(plugin) {
startPlugin(koin)
}
}.onFailure { e ->
logger.w(e) { "Unable to load common logic of $plugin" }
}.onSuccess {
logger.i { "Complete loading of $plugin common logic" }
}
}
}
override suspend fun BehaviourContextWithFSM<State>.setupBotPlugin(koin: Koin) {
config.botPlugins.forEach { plugin ->
runCatchingSafely {
logger.i("Start loading of $plugin")
with(plugin) {
@ -91,9 +126,11 @@ data class PlaguBot(
setupDI(config.databaseConfig.database, json)
}
)
logger.i("Modules loaded")
logger.i("Modules loaded. Starting koin")
GlobalContext.startKoin(koinApp)
logger.i("Koin started")
logger.i("Koin started. Starting plugins common logic")
startPlugin(koinApp.koin)
logger.i("Plugins common logic started. Starting setup of bot logic part")
lateinit var behaviourContext: BehaviourContext
val onStartContextsConflictResolver by lazy { koinApp.koin.getAllDistinct<OnStartContextsConflictResolver>() }
val onUpdateContextsConflictResolver by lazy { koinApp.koin.getAllDistinct<OnUpdateContextsConflictResolver>() }

View File

@ -1,15 +1,20 @@
package dev.inmo.plagubot.config
import dev.inmo.micro_utils.common.Warning
import dev.inmo.micro_utils.startup.plugin.StartPlugin
import dev.inmo.plagubot.Plugin
import dev.inmo.tgbotapi.utils.telegramBotAPIDefaultUrl
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
@Warning("This API is internal and can be changed without notifications of mentions of changes")
@Warning("This API is internal and can be changed without notifications or mentions of changes")
@Serializable
data class Config(
val botToken: String,
val plugins: List<Plugin>,
val plugins: List<StartPlugin>,
@SerialName("database")
val databaseConfig: DatabaseConfig = DatabaseConfig(),
)
val botApiServer: String = telegramBotAPIDefaultUrl
) {
val botPlugins = plugins.filterIsInstance<Plugin>()
}

View File

@ -17,7 +17,7 @@ allprojects {
mavenCentral()
mavenLocal()
maven { url 'https://jitpack.io' }
maven { url "https://git.inmo.dev/api/packages/InsanusMokrassar/maven" }
maven { url "https://nexus.inmo.dev/repository/maven-releases/" }
}
}

View File

@ -20,13 +20,13 @@ if (new File(projectDir, "secret.gradle").exists()) {
releaseAssets.from('bot/build/distributions')
owner "InsanusMokrassar"
repo "PlaguBot"
owner = "InsanusMokrassar"
repo = "PlaguBot"
tagName "v${project.version}"
releaseName "${project.version}"
targetCommitish "${project.version}"
tagName = "v${project.version}"
releaseName = "${project.version}"
targetCommitish = "${project.version}"
body getCurrentVersionChangelog()
body = getCurrentVersionChangelog()
}
}

View File

@ -5,4 +5,4 @@ kotlin.js.generate.externals=true
kotlin.incremental=true
group=dev.inmo
version=7.2.2
version=8.3.0

View File

@ -1,28 +1,22 @@
[versions]
kt = "1.8.22"
kt-serialization = "1.5.1"
kt-coroutines = "1.7.3"
kt = "1.9.23"
kt-serialization = "1.6.3"
kt-coroutines = "1.8.0"
microutils = "0.19.9"
tgbotapi = "9.2.1"
kslog = "1.1.2"
microutils = "0.20.45"
tgbotapi = "12.0.1"
ksp = "1.8.22-1.0.11"
ksp = "1.9.23-1.0.20"
jb-exposed = "0.41.1"
jb-dokka = "1.8.20"
jb-exposed = "0.49.0"
jb-dokka = "1.9.20"
sqlite = "3.43.0.0"
sqlite = "3.45.3.0"
klock = "4.0.3"
uuid = "0.7.1"
gh-release = "2.5.2"
ktor = "2.3.4"
gh-release = "2.4.1"
koin = "3.4.3"
koin = "3.5.6"
[libraries]
@ -36,7 +30,8 @@ tgbotapi-behaviourBuilder-fsm = { module = "dev.inmo:tgbotapi.behaviour_builder.
microutils-repos-exposed = { module = "dev.inmo:micro_utils.repos.exposed", version.ref = "microutils" }
microutils-koin = { module = "dev.inmo:micro_utils.koin", version.ref = "microutils" }
microutils-koin-generator = { module = "dev.inmo:micro_utils.koin.generator", version.ref = "microutils" }
kslog = { module = "dev.inmo:kslog", version.ref = "kslog" }
microutils-startup-launcher = { module = "dev.inmo:micro_utils.startup.launcher", version.ref = "microutils" }
microutils-startup-plugin = { module = "dev.inmo:micro_utils.startup.plugin", version.ref = "microutils" }
koin = { module = "io.insert-koin:koin-core", version.ref = "koin" }

View File

@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

View File

@ -14,11 +14,12 @@ dependencies {
api libs.tgbotapi
api libs.microutils.repos.exposed
api libs.microutils.startup.plugin
api libs.koin
}
java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}

View File

@ -2,11 +2,11 @@ apply plugin: 'maven-publish'
task javadocJar(type: Jar) {
from javadoc
classifier = 'javadoc'
archiveClassifier = 'javadoc'
}
task sourcesJar(type: Jar) {
from sourceSets.main.allSource
classifier = 'sources'
archiveClassifier = 'sources'
}
publishing {
@ -49,18 +49,14 @@ publishing {
}
}
repositories {
if (project.hasProperty('GITEA_TOKEN') || System.getenv('GITEA_TOKEN') != null) {
if ((project.hasProperty('INMONEXUS_USER') || System.getenv('INMONEXUS_USER') != null) && (project.hasProperty('INMONEXUS_PASSWORD') || System.getenv('INMONEXUS_PASSWORD') != null)) {
maven {
name = "Gitea"
url = uri("https://git.inmo.dev/api/packages/InsanusMokrassar/maven")
name = "InmoNexus"
url = uri("https://nexus.inmo.dev/repository/maven-releases/")
credentials(HttpHeaderCredentials) {
name = "Authorization"
value = project.hasProperty('GITEA_TOKEN') ? project.property('GITEA_TOKEN') : System.getenv('GITEA_TOKEN')
}
authentication {
header(HttpHeaderAuthentication)
credentials {
username = project.hasProperty('INMONEXUS_USER') ? project.property('INMONEXUS_USER') : System.getenv('INMONEXUS_USER')
password = project.hasProperty('INMONEXUS_PASSWORD') ? project.property('INMONEXUS_PASSWORD') : System.getenv('INMONEXUS_PASSWORD')
}
}
@ -96,4 +92,27 @@ if (project.hasProperty("signing.gnupg.keyName")) {
dependsOn(it)
}
}
// Workaround to make android sign operations depend on signing tasks
project.getTasks().withType(AbstractPublishToMaven.class).configureEach {
def signingTasks = project.getTasks().withType(Sign.class)
mustRunAfter(signingTasks)
}
// Workaround to make test tasks use sign
project.getTasks().withType(Sign.class).configureEach { signTask ->
def withoutSign = (signTask.name.startsWith("sign") ? signTask.name.minus("sign") : signTask.name)
def pubName = withoutSign.endsWith("Publication") ? withoutSign.substring(0, withoutSign.length() - "Publication".length()) : withoutSign
// These tasks only exist for native targets, hence findByName() to avoid trying to find them for other targets
// Task ':linkDebugTest<platform>' uses this output of task ':sign<platform>Publication' without declaring an explicit or implicit dependency
def debugTestTask = tasks.findByName("linkDebugTest$pubName")
if (debugTestTask != null) {
signTask.mustRunAfter(debugTestTask)
}
// Task ':compileTestKotlin<platform>' uses this output of task ':sign<platform>Publication' without declaring an explicit or implicit dependency
def testTask = tasks.findByName("compileTestKotlin$pubName")
if (testTask != null) {
signTask.mustRunAfter(testTask)
}
}
}

View File

@ -1 +1 @@
{"licenses":[{"id":"Apache-2.0","title":"Apache Software License 2.0","url":"https://github.com/InsanusMokrassar/PlaguBot/LICENSE"}],"mavenConfig":{"name":"PlaguBot Plugin","description":"Base dependency for whole PlaguBot project","url":"https://github.com/InsanusMokrassar/PlaguBot","vcsUrl":"ssh://git@github.com/InsanusMokrassar/PlaguBot.git","developers":[{"id":"InsanusMokrassar","name":"Aleksei Ovsiannikov","eMail":"ovsyannikov.alexey95@gmail.com"}],"repositories":[{"name":"Gitea","url":"https://git.inmo.dev/api/packages/InsanusMokrassar/maven","credsType":{"type":"dev.inmo.kmppscriptbuilder.core.models.MavenPublishingRepository.CredentialsType.HttpHeaderCredentials","headerName":"Authorization","headerValueProperty":"GITEA_TOKEN"}},{"name":"sonatype","url":"https://oss.sonatype.org/service/local/staging/deploy/maven2/"}],"gpgSigning":{"type":"dev.inmo.kmppscriptbuilder.core.models.GpgSigning.Optional"}},"type":"JVM"}
{"licenses":[{"id":"Apache-2.0","title":"Apache Software License 2.0","url":"https://github.com/InsanusMokrassar/PlaguBot/LICENSE"}],"mavenConfig":{"name":"PlaguBot Plugin","description":"Base dependency for whole PlaguBot project","url":"https://github.com/InsanusMokrassar/PlaguBot","vcsUrl":"ssh://git@github.com/InsanusMokrassar/PlaguBot.git","developers":[{"id":"InsanusMokrassar","name":"Aleksei Ovsiannikov","eMail":"ovsyannikov.alexey95@gmail.com"}],"repositories":[{"name":"InmoNexus","url":"https://nexus.inmo.dev/repository/maven-releases/"},{"name":"sonatype","url":"https://oss.sonatype.org/service/local/staging/deploy/maven2/"}],"gpgSigning":{"type":"dev.inmo.kmppscriptbuilder.core.models.GpgSigning.Optional"}},"type":"JVM"}

View File

@ -1,6 +1,8 @@
package dev.inmo.plagubot
import dev.inmo.micro_utils.fsm.common.State
import dev.inmo.micro_utils.startup.plugin.StartPlugin
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
@ -17,14 +19,18 @@ import org.koin.core.module.Module
* too.
*/
@Serializable(PluginSerializer::class)
interface Plugin {
interface Plugin : StartPlugin {
fun KtorRequestsExecutorBuilder.setupBotClient() {}
/**
* This method will be called when this plugin should configure di module based on the incoming params
*/
fun Module.setupDI(
database: Database,
params: JsonObject
) {}
) {
setupDI(params)
}
/**
* Override this method in cases when you want to declare common bot behaviour. In case you wish to use FSM, you