Compare commits

...

4 Commits
0.0.2 ... 0.0.4

Author SHA1 Message Date
fdee11d637 start 0.0.4 2020-11-17 21:38:45 +06:00
5376afecc2 Merge pull request #1 from InsanusMokrassar/0.0.3
0.0.3
2020-11-13 11:32:37 +06:00
b4106d7710 initPlaguBot 2020-11-13 11:25:04 +06:00
f515c7548b start 0.0.3 2020-11-13 11:23:35 +06:00
3 changed files with 30 additions and 14 deletions

View File

@@ -1,5 +1,16 @@
# Changelog
## 0.0.4
* `Versions`
* `tgbotapi`: `0.30.4` -> `0.30.7`
* `microutils`: `0.3.4` -> `0.4.1`
## 0.0.3
* `Bot`:
* New function `initPlaguBot` which actually will launch the bot
## 0.0.2
* `Versions`

View File

@@ -11,17 +11,10 @@ import kotlinx.coroutines.*
import kotlinx.serialization.InternalSerializationApi
import java.io.File
/**
* This method by default expects one argument in [args] field: path to config
*/
@InternalSerializationApi
suspend fun main(args: Array<String>) {
val (configPath) = args
val file = File(configPath)
val config = configSerialFormat.decodeFromString(Config.serializer(), file.readText())
val scope = CoroutineScope(Dispatchers.Default)
suspend inline fun initPlaguBot(
config: Config,
scope: CoroutineScope = CoroutineScope(Dispatchers.Default)
) {
val bot = telegramBot(config.botToken)
bot.startGettingFlowsUpdatesByLongPolling(scope = scope) {
@@ -41,6 +34,18 @@ suspend fun main(args: Array<String>) {
}
}
}
}
/**
* This method by default expects one argument in [args] field: path to config
*/
@InternalSerializationApi
suspend fun main(args: Array<String>) {
val (configPath) = args
val file = File(configPath)
val config = configSerialFormat.decodeFromString(Config.serializer(), file.readText())
val scope = CoroutineScope(Dispatchers.Default)
initPlaguBot(config, scope)
scope.coroutineContext.job.join()
}

View File

@@ -8,8 +8,8 @@ kotlin_version=1.4.10
kotlin_coroutines_version=1.4.1
kotlin_serialisation_runtime_version=1.0.1
kotlin_exposed_version=0.28.1
tgbotapi_version=0.30.4
microutils_version=0.3.3
tgbotapi_version=0.30.7
microutils_version=0.4.1
klassindex_version=4.1.0-rc.1
sqlite_version=3.30.1
@@ -17,4 +17,4 @@ gradle_bintray_plugin_version=1.8.5
github_release_plugin_version=2.2.12
group=dev.inmo
version=0.0.2
version=0.0.4