mirror of
https://github.com/InsanusMokrassar/PlaguBot.git
synced 2024-11-21 23:23:47 +00:00
Add opportunity to use config in setup bot client
This commit is contained in:
parent
d772d275b3
commit
bb06ba1ca7
@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
## 9.3.0
|
## 9.3.0
|
||||||
|
|
||||||
|
* Add opportunity to use config in setup bot client
|
||||||
|
|
||||||
## 9.2.0
|
## 9.2.0
|
||||||
|
|
||||||
* `Versions`:
|
* `Versions`:
|
||||||
|
@ -42,9 +42,16 @@ data class PlaguBot(
|
|||||||
token = config.botToken,
|
token = config.botToken,
|
||||||
apiUrl = config.botApiServer
|
apiUrl = config.botApiServer
|
||||||
) {
|
) {
|
||||||
setupBotClient()
|
setupBotClient(json)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun KtorRequestsExecutorBuilder.setupBotClient(params: JsonObject) {
|
||||||
|
config.botPlugins.forEach {
|
||||||
|
with(it) {
|
||||||
|
setupBotClient(params)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
override fun KtorRequestsExecutorBuilder.setupBotClient() {
|
override fun KtorRequestsExecutorBuilder.setupBotClient() {
|
||||||
config.botPlugins.forEach {
|
config.botPlugins.forEach {
|
||||||
with(it) {
|
with(it) {
|
||||||
|
@ -21,6 +21,7 @@ import org.koin.core.module.Module
|
|||||||
@Serializable(PluginSerializer::class)
|
@Serializable(PluginSerializer::class)
|
||||||
interface Plugin : StartPlugin {
|
interface Plugin : StartPlugin {
|
||||||
fun KtorRequestsExecutorBuilder.setupBotClient() {}
|
fun KtorRequestsExecutorBuilder.setupBotClient() {}
|
||||||
|
fun KtorRequestsExecutorBuilder.setupBotClient(params: JsonObject) = 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
|
||||||
|
Loading…
Reference in New Issue
Block a user