File tree Expand file tree Collapse file tree
CustomBot/src/main/kotlin Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -4,10 +4,16 @@ import dev.inmo.kslog.common.defaultMessageFormatter
44import dev.inmo.kslog.common.setDefaultKSLog
55import dev.inmo.micro_utils.coroutines.subscribeSafelyWithoutExceptions
66import dev.inmo.tgbotapi.extensions.api.bot.getMe
7+ import dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextData
78import dev.inmo.tgbotapi.extensions.behaviour_builder.telegramBotWithBehaviourAndLongPolling
9+ import dev.inmo.tgbotapi.extensions.behaviour_builder.triggers_handling.onCommand
810import kotlinx.coroutines.CoroutineScope
911import kotlinx.coroutines.Dispatchers
1012
13+ private var BehaviourContextData .update
14+ get() = get(" update" )
15+ set(value) = set(" update" , value)
16+
1117/* *
1218 * This place can be the playground for your code.
1319 */
@@ -38,12 +44,19 @@ suspend fun main(vararg args: String) {
3844 }
3945 }
4046 }
47+ },
48+ subcontextInitialAction = {
49+ data.update = it
4150 }
4251 ) {
4352 // start here!!
4453 val me = getMe()
4554 println (me)
4655
56+ onCommand(" start" ) {
57+ println (data.update)
58+ }
59+
4760 allUpdatesFlow.subscribeSafelyWithoutExceptions(this ) {
4861 println (it)
4962 }
Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ kotlin.daemon.jvmargs=-Xmx3g -Xms500m
66
77
88kotlin_version =2.0.21
9- telegram_bot_api_version =20.0.1
9+ telegram_bot_api_version =20.1.0
1010micro_utils_version =0.23.0
1111serialization_version =1.7.3
1212ktor_version =3.0.1
You can’t perform that action at this time.
0 commit comments