1
0
mirror of https://github.com/InsanusMokrassar/TelegramBotAPI.git synced 2025-12-30 18:09:25 +00:00

Compare commits

..

3 Commits

Author SHA1 Message Date
738728f647 Update libs.versions.toml 2024-06-21 13:21:05 +06:00
abbb4e2dff update microutils 2024-06-16 22:34:44 +06:00
c3fa8a6d33 update microutils dependency 2024-06-16 00:29:13 +06:00
3 changed files with 6 additions and 4 deletions

View File

@@ -6,4 +6,4 @@ kotlin.incremental=true
kotlin.incremental.js=true
library_group=dev.inmo
library_version=14.0.2-preview4
library_version=14.0.2-preview6

View File

@@ -13,7 +13,7 @@ ktor = "2.3.11"
ksp = "1.9.23-1.0.20"
kotlin-poet = "1.16.0"
microutils = "0.20.52"
microutils = "0.21.0"
kslog = "1.3.4"
versions = "0.51.0"

View File

@@ -1,6 +1,7 @@
package dev.inmo.tgbotapi.extensions.api
import dev.inmo.micro_utils.coroutines.LinkedSupervisorJob
import dev.inmo.micro_utils.coroutines.LinkedSupervisorScope
import dev.inmo.micro_utils.coroutines.launchSafelyWithoutExceptions
import dev.inmo.tgbotapi.abstracts.*
import dev.inmo.tgbotapi.abstracts.types.WithReplyMarkup
@@ -54,8 +55,9 @@ suspend fun TelegramBot.handleLiveLocation(
val updateMessageJob = if (liveTimeMillis == indefiniteLivePeriodDelayMillis) { // do not launch refreshing of message for indefinite live locations
null
} else {
CoroutineScope(currentCoroutineContext().LinkedSupervisorJob()).launchSafelyWithoutExceptions(start = CoroutineStart.LAZY) {
while (isActive) {
val scope = currentCoroutineContext().LinkedSupervisorScope()
scope.launchSafelyWithoutExceptions(start = CoroutineStart.LAZY) {
while (scope.isActive) {
delay(liveTimeMillis)
// Remove previous location message info to resend live location message
currentLiveLocationMessage = null