This commit is contained in:
InsanusMokrassar 2021-11-12 14:05:42 +06:00
parent 8885047409
commit d7638d620f
4 changed files with 9 additions and 22 deletions

View File

@ -5,18 +5,6 @@ import kotlinx.coroutines.*
import kotlinx.serialization.InternalSerializationApi import kotlinx.serialization.InternalSerializationApi
import java.io.File import java.io.File
@Deprecated(
"This method is redundant due to new class PlaguBot",
ReplaceWith(
"PlaguBot(config).start(scope)",
"dev.inmo.plagubot.PlaguBot"
)
)
suspend inline fun initPlaguBot(
config: Config,
scope: CoroutineScope = CoroutineScope(Dispatchers.Default)
): Job = PlaguBot(config).start(scope)
/** /**
* This method by default expects one argument in [args] field: path to config * This method by default expects one argument in [args] field: path to config
*/ */

View File

@ -4,8 +4,7 @@ import dev.inmo.micro_utils.coroutines.safelyWithoutExceptions
import dev.inmo.plagubot.config.* import dev.inmo.plagubot.config.*
import dev.inmo.tgbotapi.bot.Ktor.telegramBot import dev.inmo.tgbotapi.bot.Ktor.telegramBot
import dev.inmo.tgbotapi.extensions.api.bot.setMyCommands import dev.inmo.tgbotapi.extensions.api.bot.setMyCommands
import dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContext import dev.inmo.tgbotapi.extensions.behaviour_builder.*
import dev.inmo.tgbotapi.extensions.behaviour_builder.buildBehaviour
import dev.inmo.tgbotapi.types.BotCommand import dev.inmo.tgbotapi.types.BotCommand
import dev.inmo.tgbotapi.types.botCommandsLimit import dev.inmo.tgbotapi.types.botCommandsLimit
import kotlinx.coroutines.* import kotlinx.coroutines.*
@ -50,7 +49,7 @@ data class PlaguBot(
*/ */
suspend fun start( suspend fun start(
scope: CoroutineScope = CoroutineScope(Dispatchers.Default) scope: CoroutineScope = CoroutineScope(Dispatchers.Default)
): Job = bot.buildBehaviour(scope) { ): Job = bot.buildBehaviourWithLongPolling(scope) {
invoke(database, paramsMap) invoke(database, paramsMap)
} }
} }

View File

@ -6,15 +6,15 @@ kotlin.incremental=true
kotlin_version=1.5.31 kotlin_version=1.5.31
kotlin_coroutines_version=1.5.2 kotlin_coroutines_version=1.5.2
kotlin_serialisation_runtime_version=1.2.2 kotlin_serialisation_runtime_version=1.3.1
kotlin_exposed_version=0.34.2 kotlin_exposed_version=0.36.1
sdi_version=0.5.0 sdi_version=0.6.0
tgbotapi_version=0.35.9 tgbotapi_version=0.37.0
microutils_version=0.5.28 microutils_version=0.8.2
klassindex_version=4.1.0-rc.1 klassindex_version=4.1.0-rc.1
sqlite_version=3.34.0 sqlite_version=3.36.0.3
github_release_plugin_version=2.2.12 github_release_plugin_version=2.2.12

View File

@ -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-6.8.3-bin.zip distributionUrl=https\://services.gradle.org/distributions/gradle-7.3-bin.zip
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists