mirror of
https://github.com/InsanusMokrassar/PlaguBot.git
synced 2025-12-16 19:25:57 +00:00
Compare commits
103 Commits
v4.0.0
...
8efe977e76
| Author | SHA1 | Date | |
|---|---|---|---|
| 8efe977e76 | |||
| 8290a68654 | |||
| 493a18a0f7 | |||
| 36608937af | |||
| 1b1b069d93 | |||
| 37b5b8e867 | |||
| 468310c819 | |||
| 0d27a4f6f7 | |||
| f9d131866f | |||
| 451b2bbc39 | |||
| d51e2d8e7c | |||
| 6c45a8c848 | |||
| 8a7e05580d | |||
| 8b78f2901f | |||
| cad8743ced | |||
| 8f827e9f79 | |||
| 28039df992 | |||
| 18019c37ea | |||
| 8a84f65a12 | |||
| 49f30ab939 | |||
| 8a15deceb8 | |||
| ea3273c4cf | |||
| 439972e783 | |||
| 08907291c5 | |||
| 0f4819a83d | |||
| 7abdf18491 | |||
| 98a91ea357 | |||
| 934f603a8a | |||
| 76e9cdae8d | |||
| fbe166f2b4 | |||
| 30cf190461 | |||
| 9d72d79321 | |||
| 33057dd2cb | |||
| e1bb8e9799 | |||
| fd5e979f11 | |||
| 20e1f042f1 | |||
| 0e65a425c3 | |||
| 517ab1e1a4 | |||
| 977cf32669 | |||
| 5bd1916fb5 | |||
| 8c22b418f8 | |||
| 3663f987bc | |||
| 93d15af80d | |||
| 27c5f379a4 | |||
| ae7a7b84ac | |||
| 5b98aef237 | |||
| 3755972394 | |||
| 5d5312c66f | |||
| f79fef3dae | |||
| 2c8dc80eae | |||
| a2a2fe7ef4 | |||
| 34cadab809 | |||
| 784e041519 | |||
| 4784f05c8e | |||
| e89b0a6ba2 | |||
| b48d278446 | |||
| 072a64362d | |||
| 7715f519e3 | |||
| 7982f27217 | |||
| eeb3ae1dbe | |||
| 8a73fda6fa | |||
| 05e94249af | |||
| 74c36c66f1 | |||
| 5153f732ce | |||
| fb23e9be79 | |||
| 292640b465 | |||
| a863d91bab | |||
| d1064bb9cd | |||
| a9c3b937e7 | |||
| 6757354652 | |||
| c65efb6ffb | |||
| f9cc279854 | |||
| b2d00cb5ae | |||
| 782721751a | |||
| 01086766ba | |||
| bf0a6ab659 | |||
| a3e6f8a6b5 | |||
| cd9ba5dc19 | |||
| 8e0d35a80d | |||
| a49fb60555 | |||
| ec26179d2a | |||
| daed26cba6 | |||
| 7c820b70ac | |||
| edb15f11db | |||
| 18000429b0 | |||
| d975e61966 | |||
| 663e00cad6 | |||
| 6725193545 | |||
| ccfd91b1ac | |||
| c8b69d641f | |||
| 7af11fc427 | |||
| 59b91fc1ff | |||
| 4293096ed2 | |||
| 42dd98426c | |||
| 744520c73f | |||
| 1b8ae09866 | |||
| 3027e39665 | |||
| b77fe446f8 | |||
| bc11d7508f | |||
| cd9af3c216 | |||
| c60face0e6 | |||
| 334ca1a184 | |||
| b7bb6f10a9 |
4
.github/workflows/build.yml
vendored
4
.github/workflows/build.yml
vendored
@@ -8,9 +8,9 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
- name: Set up JDK 11
|
- name: Set up JDK 17
|
||||||
uses: actions/setup-java@v1
|
uses: actions/setup-java@v1
|
||||||
with:
|
with:
|
||||||
java-version: 11
|
java-version: 17
|
||||||
- name: Build with Gradle
|
- name: Build with Gradle
|
||||||
run: ./gradlew build
|
run: ./gradlew build
|
||||||
|
|||||||
193
CHANGELOG.md
193
CHANGELOG.md
@@ -1,5 +1,198 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## 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`:
|
||||||
|
* Now you may customize both `onStart` and `onUpdate` conflicts resolvers
|
||||||
|
|
||||||
|
## 7.2.1
|
||||||
|
|
||||||
|
* `Versions`:
|
||||||
|
* `tgbotapi`: `9.2.1`
|
||||||
|
* `ktor`: `2.3.4`
|
||||||
|
|
||||||
|
## 7.2.0
|
||||||
|
|
||||||
|
* `Version`:
|
||||||
|
* `tgbotapi`: `9.2.0`
|
||||||
|
* `kslog`: `1.1.2`
|
||||||
|
* `sqlite`: `3.43.0.0`
|
||||||
|
|
||||||
|
## 7.1.0
|
||||||
|
|
||||||
|
* `Version`:
|
||||||
|
* `microutils`: `0.19.9`
|
||||||
|
* `tgbotapi`: `9.1.0`
|
||||||
|
* `ktor`: `2.3.3`
|
||||||
|
* `coroutines`: `1.7.3`
|
||||||
|
* `koin`: `3.4.3`
|
||||||
|
|
||||||
|
## 7.0.0
|
||||||
|
|
||||||
|
* `Version`:
|
||||||
|
* `microutils`: `0.19.7`
|
||||||
|
* `tgbotapi`: `9.0.0`
|
||||||
|
* `ktor`: `2.3.2`
|
||||||
|
* `coroutines`: `1.7.2`
|
||||||
|
|
||||||
|
## 6.1.0
|
||||||
|
|
||||||
|
* `Version`:
|
||||||
|
* `kotlin`: `1.8.22`
|
||||||
|
* `microutils`: `0.19.4`
|
||||||
|
* `tgbotapi`: `8.1.0`
|
||||||
|
* `koin`: `3.4.2`
|
||||||
|
* `sqlite`: `3.42.0.0`
|
||||||
|
|
||||||
|
## 6.0.1
|
||||||
|
|
||||||
|
* `Version`:
|
||||||
|
* `microutils`: `0.19.2`
|
||||||
|
* `tgbotapi`: `8.0.1`
|
||||||
|
* `uuid`: `0.7.1`
|
||||||
|
* `ktor`: `2.3.1`
|
||||||
|
* `koin`: `3.4.1`
|
||||||
|
|
||||||
|
## 6.0.0
|
||||||
|
|
||||||
|
* `Versions`:
|
||||||
|
* `microutils`: `0.19.1`
|
||||||
|
* `tgbotapi`: `8.0.0`
|
||||||
|
* `klock`: `4.0.3`
|
||||||
|
|
||||||
|
## 5.1.3
|
||||||
|
|
||||||
|
* `Versions`:
|
||||||
|
* `serialization`: `1.5.1`
|
||||||
|
* `microutils`: `0.18.4`
|
||||||
|
* `tgbotapi`: `7.1.3`
|
||||||
|
|
||||||
|
## 5.1.2
|
||||||
|
|
||||||
|
* `Versions`:
|
||||||
|
* `microutils`: `0.18.1`
|
||||||
|
* `tgbotapi`: `7.1.2`
|
||||||
|
|
||||||
|
## 5.1.1
|
||||||
|
|
||||||
|
* `Versions`:
|
||||||
|
* `kotlin`: `1.8.21`
|
||||||
|
* `microutils`: `0.18.0`
|
||||||
|
* `tgbotapi`: `7.1.1`
|
||||||
|
|
||||||
|
## 5.1.0
|
||||||
|
|
||||||
|
* `Versions`:
|
||||||
|
* `tgbotapi`: `7.1.0`
|
||||||
|
* `sqlite`: `3.41.2.1`
|
||||||
|
|
||||||
|
## 5.0.2
|
||||||
|
|
||||||
|
* `Versions`:
|
||||||
|
* `kotlin`: `1.8.20`
|
||||||
|
* `microutils`: `0.17.8`
|
||||||
|
* `tgbotapi`: `7.0.2`
|
||||||
|
* `kslog`: `1.1.1`
|
||||||
|
* `ktor`: `2.3.0`
|
||||||
|
* `koin`: `3.4.0`
|
||||||
|
|
||||||
|
## 5.0.1
|
||||||
|
|
||||||
|
* `Versions`:
|
||||||
|
* `tgbotapi`: `7.0.1`
|
||||||
|
|
||||||
|
## 5.0.0
|
||||||
|
|
||||||
|
* `Versions`:
|
||||||
|
* `tgbotapi`: `7.0.0`
|
||||||
|
* `microutils`: `0.17.5`
|
||||||
|
|
||||||
|
## 4.1.0
|
||||||
|
|
||||||
|
* `Versions`:
|
||||||
|
* `tgbotapi`: `6.1.0`
|
||||||
|
* `microutils`: `0.17.3`
|
||||||
|
|
||||||
|
## 4.0.3
|
||||||
|
|
||||||
|
* `Versions`:
|
||||||
|
* `tgbotapi`: `6.0.3`
|
||||||
|
* `microutils`: `0.17.2`
|
||||||
|
|
||||||
|
## 4.0.2
|
||||||
|
|
||||||
|
* `Versions`:
|
||||||
|
* `tgbotapi`: `6.0.2`
|
||||||
|
|
||||||
|
## 4.0.1
|
||||||
|
|
||||||
|
* `Versions`:
|
||||||
|
* `tgbotapi`: `6.0.1`
|
||||||
|
* `microutils`: `17.0.1`
|
||||||
|
* `ktor`: `2.2.4`
|
||||||
|
|
||||||
|
## 4.0.0
|
||||||
|
|
||||||
|
* `Versions`:
|
||||||
|
* `kotlin`: `1.8.10`
|
||||||
|
* `tgbotapi`: `6.0.0`
|
||||||
|
* `microutils`: `0.17.0`
|
||||||
|
|
||||||
## 3.5.0
|
## 3.5.0
|
||||||
|
|
||||||
* `Versions`:
|
* `Versions`:
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ plugins {
|
|||||||
id 'org.jetbrains.kotlin.jvm'
|
id 'org.jetbrains.kotlin.jvm'
|
||||||
id "org.jetbrains.kotlin.plugin.serialization"
|
id "org.jetbrains.kotlin.plugin.serialization"
|
||||||
id 'application'
|
id 'application'
|
||||||
|
id "com.google.devtools.ksp"
|
||||||
}
|
}
|
||||||
|
|
||||||
project.group="$group"
|
project.group="$group"
|
||||||
@@ -18,7 +19,8 @@ dependencies {
|
|||||||
api libs.tgbotapi
|
api libs.tgbotapi
|
||||||
api libs.tgbotapi.behaviourBuilder.fsm
|
api libs.tgbotapi.behaviourBuilder.fsm
|
||||||
api libs.microutils.repos.exposed
|
api libs.microutils.repos.exposed
|
||||||
api libs.kslog
|
api libs.microutils.koin
|
||||||
|
api libs.microutils.startup.launcher
|
||||||
|
|
||||||
api libs.sqlite
|
api libs.sqlite
|
||||||
|
|
||||||
@@ -32,7 +34,10 @@ application {
|
|||||||
}
|
}
|
||||||
|
|
||||||
java {
|
java {
|
||||||
sourceCompatibility = JavaVersion.VERSION_1_8
|
sourceCompatibility = JavaVersion.VERSION_17
|
||||||
targetCompatibility = JavaVersion.VERSION_1_8
|
targetCompatibility = JavaVersion.VERSION_17
|
||||||
|
}
|
||||||
|
|
||||||
|
ksp { // this generator do not require any arguments and we should left `ksp` empty
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,11 +2,11 @@ apply plugin: 'maven-publish'
|
|||||||
|
|
||||||
task javadocJar(type: Jar) {
|
task javadocJar(type: Jar) {
|
||||||
from javadoc
|
from javadoc
|
||||||
classifier = 'javadoc'
|
archiveClassifier = 'javadoc'
|
||||||
}
|
}
|
||||||
task sourcesJar(type: Jar) {
|
task sourcesJar(type: Jar) {
|
||||||
from sourceSets.main.allSource
|
from sourceSets.main.allSource
|
||||||
classifier = 'sources'
|
archiveClassifier = 'sources'
|
||||||
}
|
}
|
||||||
|
|
||||||
publishing {
|
publishing {
|
||||||
@@ -49,18 +49,14 @@ publishing {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
repositories {
|
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 {
|
maven {
|
||||||
name = "Gitea"
|
name = "InmoNexus"
|
||||||
url = uri("https://git.inmo.dev/api/packages/InsanusMokrassar/maven")
|
url = uri("https://nexus.inmo.dev/repository/maven-releases/")
|
||||||
|
|
||||||
credentials(HttpHeaderCredentials) {
|
credentials {
|
||||||
name = "Authorization"
|
username = project.hasProperty('INMONEXUS_USER') ? project.property('INMONEXUS_USER') : System.getenv('INMONEXUS_USER')
|
||||||
value = project.hasProperty('GITEA_TOKEN') ? project.property('GITEA_TOKEN') : System.getenv('GITEA_TOKEN')
|
password = project.hasProperty('INMONEXUS_PASSWORD') ? project.property('INMONEXUS_PASSWORD') : System.getenv('INMONEXUS_PASSWORD')
|
||||||
}
|
|
||||||
|
|
||||||
authentication {
|
|
||||||
header(HttpHeaderAuthentication)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -96,4 +92,27 @@ if (project.hasProperty("signing.gnupg.keyName")) {
|
|||||||
dependsOn(it)
|
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)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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"}
|
||||||
@@ -32,8 +32,6 @@ object HelloPlugin : Plugin {
|
|||||||
override fun Module.setupDI(database: Database, params: JsonObject) {
|
override fun Module.setupDI(database: Database, params: JsonObject) {
|
||||||
single {
|
single {
|
||||||
get<Json>().decodeFromJsonElement(HelloPluginConfig.serializer(), params["helloPlugin"] ?: return@single null)
|
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
|
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) {
|
override suspend fun BehaviourContextWithFSM<State>.setupBotPlugin(koin: Koin) {
|
||||||
val toPrint = koin.getOrNull<HelloPluginConfig>() ?.print ?: "Hello :)"
|
val toPrint = koin.getOrNull<HelloPluginConfig>() ?.print ?: "Hello :)"
|
||||||
logger.d { toPrint }
|
logger.d { toPrint }
|
||||||
|
|||||||
@@ -0,0 +1,16 @@
|
|||||||
|
package dev.inmo.plagubot
|
||||||
|
|
||||||
|
import dev.inmo.micro_utils.fsm.common.State
|
||||||
|
|
||||||
|
fun interface OnStartContextsConflictResolver {
|
||||||
|
/**
|
||||||
|
* @param old Old state which is currently placed on the [State.context]
|
||||||
|
* @param new New state pretend to replace [old] one
|
||||||
|
* @return Should return:
|
||||||
|
*
|
||||||
|
* * Null in case when current realization unable to resolve conflict
|
||||||
|
* * False when current realization knows that [new] [State] must **not** replace [old] one
|
||||||
|
* * True when current realization knows that [new] [State] must replace [old] one
|
||||||
|
*/
|
||||||
|
suspend operator fun invoke(old: State, new: State): Boolean?
|
||||||
|
}
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
package dev.inmo.plagubot
|
||||||
|
|
||||||
|
import dev.inmo.micro_utils.fsm.common.State
|
||||||
|
|
||||||
|
fun interface OnUpdateContextsConflictResolver {
|
||||||
|
/**
|
||||||
|
* This method will be called when [sourceStateWithOldContext] [State.context] and [newStateWithNewContext] are not equal and currently there is
|
||||||
|
* launched [currentStateOnNewContext] state on the chain with [State.context] from [currentStateOnNewContext]
|
||||||
|
*
|
||||||
|
* @param sourceStateWithOldContext Old state where from [newStateWithNewContext] came
|
||||||
|
* @param newStateWithNewContext New state with changing [State.context] (it is different with [sourceStateWithOldContext] [State.context])
|
||||||
|
* @param currentStateOnNewContext State which is currently running on [newStateWithNewContext] [State.context]
|
||||||
|
* @return Should return:
|
||||||
|
*
|
||||||
|
* * Null in case when current realization unable to resolve conflict
|
||||||
|
* * False when [currentStateOnNewContext] **should not** be stopped in favor to [newStateWithNewContext]
|
||||||
|
* * True when [currentStateOnNewContext] **should** be stopped in favor to [newStateWithNewContext]
|
||||||
|
*/
|
||||||
|
suspend operator fun invoke(sourceStateWithOldContext: State, newStateWithNewContext: State, currentStateOnNewContext: State): Boolean?
|
||||||
|
}
|
||||||
@@ -6,7 +6,9 @@ import dev.inmo.micro_utils.coroutines.runCatchingSafely
|
|||||||
import dev.inmo.micro_utils.fsm.common.State
|
import dev.inmo.micro_utils.fsm.common.State
|
||||||
import dev.inmo.micro_utils.fsm.common.StatesManager
|
import dev.inmo.micro_utils.fsm.common.StatesManager
|
||||||
import dev.inmo.micro_utils.fsm.common.managers.*
|
import dev.inmo.micro_utils.fsm.common.managers.*
|
||||||
|
import dev.inmo.micro_utils.koin.getAllDistinct
|
||||||
import dev.inmo.plagubot.config.*
|
import dev.inmo.plagubot.config.*
|
||||||
|
import dev.inmo.tgbotapi.bot.ktor.KtorRequestsExecutorBuilder
|
||||||
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
|
||||||
import dev.inmo.tgbotapi.extensions.behaviour_builder.*
|
import dev.inmo.tgbotapi.extensions.behaviour_builder.*
|
||||||
@@ -36,19 +38,36 @@ data class PlaguBot(
|
|||||||
private val config: Config
|
private val config: Config
|
||||||
) : Plugin {
|
) : Plugin {
|
||||||
@Transient
|
@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) {
|
override fun KtorRequestsExecutorBuilder.setupBotClient() {
|
||||||
single { config }
|
config.botPlugins.forEach {
|
||||||
single { config.plugins }
|
with(it) {
|
||||||
single { config.databaseConfig }
|
setupBotClient()
|
||||||
single { config.databaseConfig.database }
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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 { defaultJsonFormat }
|
||||||
single { this@PlaguBot }
|
single { this@PlaguBot }
|
||||||
single { bot }
|
single { bot }
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun Module.setupDI(database: Database, params: JsonObject) {
|
||||||
|
setupDI(params)
|
||||||
|
|
||||||
includes(
|
includes(
|
||||||
config.plugins.mapNotNull {
|
config.botPlugins.mapNotNull {
|
||||||
runCatching {
|
runCatching {
|
||||||
module {
|
module {
|
||||||
with(it) {
|
with(it) {
|
||||||
@@ -56,14 +75,31 @@ data class PlaguBot(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}.onFailure { e ->
|
}.onFailure { e ->
|
||||||
logger.w("Unable to load DI part of $it", e)
|
logger.w(e) { "Unable to load DI part of $it" }
|
||||||
}.getOrNull()
|
}.getOrNull()
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
override suspend fun BehaviourContextWithFSM<State>.setupBotPlugin(koin: Koin) {
|
override suspend fun startPlugin(koin: Koin) {
|
||||||
|
super.startPlugin(koin)
|
||||||
|
|
||||||
config.plugins.forEach { plugin ->
|
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 {
|
runCatchingSafely {
|
||||||
logger.i("Start loading of $plugin")
|
logger.i("Start loading of $plugin")
|
||||||
with(plugin) {
|
with(plugin) {
|
||||||
@@ -90,10 +126,14 @@ data class PlaguBot(
|
|||||||
setupDI(config.databaseConfig.database, json)
|
setupDI(config.databaseConfig.database, json)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
logger.i("Modules loaded")
|
logger.i("Modules loaded. Starting koin")
|
||||||
GlobalContext.startKoin(koinApp)
|
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
|
lateinit var behaviourContext: BehaviourContext
|
||||||
|
val onStartContextsConflictResolver by lazy { koinApp.koin.getAllDistinct<OnStartContextsConflictResolver>() }
|
||||||
|
val onUpdateContextsConflictResolver by lazy { koinApp.koin.getAllDistinct<OnUpdateContextsConflictResolver>() }
|
||||||
bot.buildBehaviourWithFSM(
|
bot.buildBehaviourWithFSM(
|
||||||
scope = scope,
|
scope = scope,
|
||||||
defaultExceptionsHandler = {
|
defaultExceptionsHandler = {
|
||||||
@@ -101,7 +141,8 @@ data class PlaguBot(
|
|||||||
},
|
},
|
||||||
statesManager = koinApp.koin.getOrNull<StatesManager<State>>() ?: DefaultStatesManager(
|
statesManager = koinApp.koin.getOrNull<StatesManager<State>>() ?: DefaultStatesManager(
|
||||||
koinApp.koin.getOrNull<DefaultStatesManagerRepo<State>>() ?: InMemoryDefaultStatesManagerRepo<State>(),
|
koinApp.koin.getOrNull<DefaultStatesManagerRepo<State>>() ?: InMemoryDefaultStatesManagerRepo<State>(),
|
||||||
onStartContextsConflictResolver = { _, _ -> false }
|
onStartContextsConflictResolver = { old, new -> onStartContextsConflictResolver.firstNotNullOfOrNull { it(old, new) } ?: false },
|
||||||
|
onUpdateContextsConflictResolver = { old, new, currentNew -> onUpdateContextsConflictResolver.firstNotNullOfOrNull { it(old, new, currentNew) } ?: false }
|
||||||
),
|
),
|
||||||
onStateHandlingErrorHandler = koinApp.koin.getOrNull<StateHandlingErrorHandler<State>>() ?: { state, e ->
|
onStateHandlingErrorHandler = koinApp.koin.getOrNull<StateHandlingErrorHandler<State>>() ?: { state, e ->
|
||||||
logger.eS(e) { "Unable to handle state $state" }
|
logger.eS(e) { "Unable to handle state $state" }
|
||||||
|
|||||||
@@ -1,15 +1,20 @@
|
|||||||
package dev.inmo.plagubot.config
|
package dev.inmo.plagubot.config
|
||||||
|
|
||||||
import dev.inmo.micro_utils.common.Warning
|
import dev.inmo.micro_utils.common.Warning
|
||||||
|
import dev.inmo.micro_utils.startup.plugin.StartPlugin
|
||||||
import dev.inmo.plagubot.Plugin
|
import dev.inmo.plagubot.Plugin
|
||||||
|
import dev.inmo.tgbotapi.utils.telegramBotAPIDefaultUrl
|
||||||
import kotlinx.serialization.SerialName
|
import kotlinx.serialization.SerialName
|
||||||
import kotlinx.serialization.Serializable
|
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
|
@Serializable
|
||||||
data class Config(
|
data class Config(
|
||||||
val botToken: String,
|
val botToken: String,
|
||||||
val plugins: List<Plugin>,
|
val plugins: List<StartPlugin>,
|
||||||
@SerialName("database")
|
@SerialName("database")
|
||||||
val databaseConfig: DatabaseConfig = DatabaseConfig(),
|
val databaseConfig: DatabaseConfig = DatabaseConfig(),
|
||||||
)
|
val botApiServer: String = telegramBotAPIDefaultUrl
|
||||||
|
) {
|
||||||
|
val botPlugins = plugins.filterIsInstance<Plugin>()
|
||||||
|
}
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ buildscript {
|
|||||||
classpath libs.buildscript.kt.gradle
|
classpath libs.buildscript.kt.gradle
|
||||||
classpath libs.buildscript.kt.serialization
|
classpath libs.buildscript.kt.serialization
|
||||||
classpath libs.buildscript.gh.release
|
classpath libs.buildscript.gh.release
|
||||||
|
classpath libs.buildscript.ksp
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -16,7 +17,7 @@ allprojects {
|
|||||||
mavenCentral()
|
mavenCentral()
|
||||||
mavenLocal()
|
mavenLocal()
|
||||||
maven { url 'https://jitpack.io' }
|
maven { url 'https://jitpack.io' }
|
||||||
maven { url "https://git.inmo.dev/api/packages/InsanusMokrassar/maven" }
|
maven { url "https://nexus.inmo.dev/repository/maven-releases/" }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -5,4 +5,4 @@ kotlin.js.generate.externals=true
|
|||||||
kotlin.incremental=true
|
kotlin.incremental=true
|
||||||
|
|
||||||
group=dev.inmo
|
group=dev.inmo
|
||||||
version=4.0.0
|
version=8.1.1
|
||||||
|
|||||||
@@ -1,26 +1,22 @@
|
|||||||
[versions]
|
[versions]
|
||||||
|
|
||||||
kt = "1.8.10"
|
kt = "1.9.22"
|
||||||
kt-serialization = "1.5.0"
|
kt-serialization = "1.6.2"
|
||||||
kt-coroutines = "1.6.4"
|
kt-coroutines = "1.7.3"
|
||||||
|
|
||||||
microutils = "0.17.0"
|
microutils = "0.20.32"
|
||||||
tgbotapi = "6.0.0"
|
tgbotapi = "10.0.1"
|
||||||
kslog = "1.0.0"
|
|
||||||
|
|
||||||
jb-exposed = "0.41.1"
|
ksp = "1.9.22-1.0.17"
|
||||||
jb-dokka = "1.7.20"
|
|
||||||
|
|
||||||
sqlite = "3.40.0.0"
|
jb-exposed = "0.47.0"
|
||||||
|
jb-dokka = "1.9.10"
|
||||||
|
|
||||||
klock = "3.4.0"
|
sqlite = "3.44.1.0"
|
||||||
uuid = "0.7.0"
|
|
||||||
|
|
||||||
ktor = "2.2.3"
|
|
||||||
|
|
||||||
gh-release = "2.4.1"
|
gh-release = "2.4.1"
|
||||||
|
|
||||||
koin = "3.3.2"
|
koin = "3.5.3"
|
||||||
|
|
||||||
[libraries]
|
[libraries]
|
||||||
|
|
||||||
@@ -32,7 +28,10 @@ kt-serialization = { module = "org.jetbrains.kotlinx:kotlinx-serialization-json"
|
|||||||
tgbotapi = { module = "dev.inmo:tgbotapi", version.ref = "tgbotapi" }
|
tgbotapi = { module = "dev.inmo:tgbotapi", version.ref = "tgbotapi" }
|
||||||
tgbotapi-behaviourBuilder-fsm = { module = "dev.inmo:tgbotapi.behaviour_builder.fsm", version.ref = "tgbotapi" }
|
tgbotapi-behaviourBuilder-fsm = { module = "dev.inmo:tgbotapi.behaviour_builder.fsm", version.ref = "tgbotapi" }
|
||||||
microutils-repos-exposed = { module = "dev.inmo:micro_utils.repos.exposed", version.ref = "microutils" }
|
microutils-repos-exposed = { module = "dev.inmo:micro_utils.repos.exposed", version.ref = "microutils" }
|
||||||
kslog = { module = "dev.inmo:kslog", version.ref = "kslog" }
|
microutils-koin = { module = "dev.inmo:micro_utils.koin", version.ref = "microutils" }
|
||||||
|
microutils-koin-generator = { module = "dev.inmo:micro_utils.koin.generator", version.ref = "microutils" }
|
||||||
|
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" }
|
koin = { module = "io.insert-koin:koin-core", version.ref = "koin" }
|
||||||
|
|
||||||
@@ -48,3 +47,4 @@ buildscript-kt-gradle = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin",
|
|||||||
buildscript-kt-serialization = { module = "org.jetbrains.kotlin:kotlin-serialization", version.ref = "kt" }
|
buildscript-kt-serialization = { module = "org.jetbrains.kotlin:kotlin-serialization", version.ref = "kt" }
|
||||||
buildscript-jb-dokka = { module = "org.jetbrains.dokka:dokka-gradle-plugin", version.ref = "jb-dokka" }
|
buildscript-jb-dokka = { module = "org.jetbrains.dokka:dokka-gradle-plugin", version.ref = "jb-dokka" }
|
||||||
buildscript-gh-release = { module = "com.github.breadmoirai:github-release", version.ref = "gh-release" }
|
buildscript-gh-release = { module = "com.github.breadmoirai:github-release", version.ref = "gh-release" }
|
||||||
|
buildscript-ksp = { module = "com.google.devtools.ksp:symbol-processing-gradle-plugin", version.ref = "ksp" }
|
||||||
|
|||||||
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
@@ -1,5 +1,5 @@
|
|||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.1-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
|
|||||||
@@ -14,11 +14,12 @@ dependencies {
|
|||||||
|
|
||||||
api libs.tgbotapi
|
api libs.tgbotapi
|
||||||
api libs.microutils.repos.exposed
|
api libs.microutils.repos.exposed
|
||||||
|
api libs.microutils.startup.plugin
|
||||||
|
|
||||||
api libs.koin
|
api libs.koin
|
||||||
}
|
}
|
||||||
|
|
||||||
java {
|
java {
|
||||||
sourceCompatibility = JavaVersion.VERSION_1_8
|
sourceCompatibility = JavaVersion.VERSION_17
|
||||||
targetCompatibility = JavaVersion.VERSION_1_8
|
targetCompatibility = JavaVersion.VERSION_17
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,11 +2,11 @@ apply plugin: 'maven-publish'
|
|||||||
|
|
||||||
task javadocJar(type: Jar) {
|
task javadocJar(type: Jar) {
|
||||||
from javadoc
|
from javadoc
|
||||||
classifier = 'javadoc'
|
archiveClassifier = 'javadoc'
|
||||||
}
|
}
|
||||||
task sourcesJar(type: Jar) {
|
task sourcesJar(type: Jar) {
|
||||||
from sourceSets.main.allSource
|
from sourceSets.main.allSource
|
||||||
classifier = 'sources'
|
archiveClassifier = 'sources'
|
||||||
}
|
}
|
||||||
|
|
||||||
publishing {
|
publishing {
|
||||||
@@ -49,18 +49,14 @@ publishing {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
repositories {
|
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 {
|
maven {
|
||||||
name = "Gitea"
|
name = "InmoNexus"
|
||||||
url = uri("https://git.inmo.dev/api/packages/InsanusMokrassar/maven")
|
url = uri("https://nexus.inmo.dev/repository/maven-releases/")
|
||||||
|
|
||||||
credentials(HttpHeaderCredentials) {
|
credentials {
|
||||||
name = "Authorization"
|
username = project.hasProperty('INMONEXUS_USER') ? project.property('INMONEXUS_USER') : System.getenv('INMONEXUS_USER')
|
||||||
value = project.hasProperty('GITEA_TOKEN') ? project.property('GITEA_TOKEN') : System.getenv('GITEA_TOKEN')
|
password = project.hasProperty('INMONEXUS_PASSWORD') ? project.property('INMONEXUS_PASSWORD') : System.getenv('INMONEXUS_PASSWORD')
|
||||||
}
|
|
||||||
|
|
||||||
authentication {
|
|
||||||
header(HttpHeaderAuthentication)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -96,4 +92,27 @@ if (project.hasProperty("signing.gnupg.keyName")) {
|
|||||||
dependsOn(it)
|
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)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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"}
|
||||||
@@ -1,6 +1,8 @@
|
|||||||
package dev.inmo.plagubot
|
package dev.inmo.plagubot
|
||||||
|
|
||||||
import dev.inmo.micro_utils.fsm.common.State
|
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.BehaviourContext
|
||||||
import dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextWithFSM
|
import dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextWithFSM
|
||||||
import kotlinx.serialization.Serializable
|
import kotlinx.serialization.Serializable
|
||||||
@@ -17,14 +19,18 @@ import org.koin.core.module.Module
|
|||||||
* too.
|
* too.
|
||||||
*/
|
*/
|
||||||
@Serializable(PluginSerializer::class)
|
@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
|
* This method will be called when this plugin should configure di module based on the incoming params
|
||||||
*/
|
*/
|
||||||
fun Module.setupDI(
|
fun Module.setupDI(
|
||||||
database: Database,
|
database: Database,
|
||||||
params: JsonObject
|
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
|
* Override this method in cases when you want to declare common bot behaviour. In case you wish to use FSM, you
|
||||||
|
|||||||
Reference in New Issue
Block a user