mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2024-11-25 11:38:45 +00:00
commit
2d3fe45389
@ -1,5 +1,10 @@
|
|||||||
# TelegramBotAPI changelog
|
# TelegramBotAPI changelog
|
||||||
|
|
||||||
|
## 5.2.0
|
||||||
|
|
||||||
|
* `Versions`:
|
||||||
|
* `MicroUtils`: `0.16.8` -> `0.16.10`
|
||||||
|
|
||||||
## 5.1.1
|
## 5.1.1
|
||||||
|
|
||||||
* `Core`:
|
* `Core`:
|
||||||
|
@ -6,4 +6,4 @@ kotlin.incremental=true
|
|||||||
kotlin.incremental.js=true
|
kotlin.incremental.js=true
|
||||||
|
|
||||||
library_group=dev.inmo
|
library_group=dev.inmo
|
||||||
library_version=5.1.1
|
library_version=5.2.0
|
||||||
|
@ -13,7 +13,7 @@ ktor = "2.2.3"
|
|||||||
ksp = "1.7.22-1.0.8"
|
ksp = "1.7.22-1.0.8"
|
||||||
kotlin-poet = "1.12.0"
|
kotlin-poet = "1.12.0"
|
||||||
|
|
||||||
microutils = "0.16.8"
|
microutils = "0.16.10"
|
||||||
|
|
||||||
github-release-plugin = "2.4.1"
|
github-release-plugin = "2.4.1"
|
||||||
dokka = "1.7.20"
|
dokka = "1.7.20"
|
||||||
|
@ -45,7 +45,8 @@ suspend fun TelegramBot.handleLiveLocation(
|
|||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageId? = null,
|
replyToMessageId: MessageId? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
|
sentMessageDeferred: CompletableDeferred<ContentMessage<LocationContent>>? = null
|
||||||
) {
|
) {
|
||||||
var currentLiveLocationMessage: ContentMessage<LocationContent>? = null
|
var currentLiveLocationMessage: ContentMessage<LocationContent>? = null
|
||||||
val updateMessageJob = CoroutineScope(currentCoroutineContext().LinkedSupervisorJob()).launchSafelyWithoutExceptions(start = CoroutineStart.LAZY) {
|
val updateMessageJob = CoroutineScope(currentCoroutineContext().LinkedSupervisorJob()).launchSafelyWithoutExceptions(start = CoroutineStart.LAZY) {
|
||||||
@ -73,7 +74,9 @@ suspend fun TelegramBot.handleLiveLocation(
|
|||||||
replyToMessageId,
|
replyToMessageId,
|
||||||
allowSendingWithoutReply,
|
allowSendingWithoutReply,
|
||||||
it.replyMarkup
|
it.replyMarkup
|
||||||
)
|
).also {
|
||||||
|
sentMessageDeferred ?.complete(it)
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
edit(
|
edit(
|
||||||
capturedLiveLocationMessage,
|
capturedLiveLocationMessage,
|
||||||
@ -102,7 +105,8 @@ suspend fun TelegramBot.handleLiveLocation(
|
|||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageId? = null,
|
replyToMessageId: MessageId? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
|
sentMessageDeferred: CompletableDeferred<ContentMessage<LocationContent>>? = null
|
||||||
) {
|
) {
|
||||||
handleLiveLocation(
|
handleLiveLocation(
|
||||||
chatId,
|
chatId,
|
||||||
@ -121,7 +125,8 @@ suspend fun TelegramBot.handleLiveLocation(
|
|||||||
disableNotification,
|
disableNotification,
|
||||||
protectContent,
|
protectContent,
|
||||||
replyToMessageId,
|
replyToMessageId,
|
||||||
allowSendingWithoutReply
|
allowSendingWithoutReply,
|
||||||
|
sentMessageDeferred
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -139,7 +144,8 @@ suspend fun TelegramBot.handleLiveLocation(
|
|||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageId? = null,
|
replyToMessageId: MessageId? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
|
sentMessageDeferred: CompletableDeferred<ContentMessage<LocationContent>>? = null
|
||||||
) {
|
) {
|
||||||
handleLiveLocation(
|
handleLiveLocation(
|
||||||
chatId,
|
chatId,
|
||||||
@ -154,6 +160,7 @@ suspend fun TelegramBot.handleLiveLocation(
|
|||||||
disableNotification,
|
disableNotification,
|
||||||
protectContent,
|
protectContent,
|
||||||
replyToMessageId,
|
replyToMessageId,
|
||||||
allowSendingWithoutReply
|
allowSendingWithoutReply,
|
||||||
|
sentMessageDeferred
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -2,15 +2,22 @@ package dev.inmo.tgbotapi.extensions.api
|
|||||||
|
|
||||||
import com.soywiz.klock.DateTime
|
import com.soywiz.klock.DateTime
|
||||||
import com.soywiz.klock.TimeSpan
|
import com.soywiz.klock.TimeSpan
|
||||||
|
import dev.inmo.micro_utils.coroutines.LinkedSupervisorJob
|
||||||
|
import dev.inmo.micro_utils.coroutines.launchSafelyWithoutExceptions
|
||||||
|
import dev.inmo.tgbotapi.abstracts.types.WithReplyMarkup
|
||||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||||
|
import dev.inmo.tgbotapi.extensions.api.edit.edit
|
||||||
import dev.inmo.tgbotapi.extensions.api.edit.location.live.editLiveLocation
|
import dev.inmo.tgbotapi.extensions.api.edit.location.live.editLiveLocation
|
||||||
import dev.inmo.tgbotapi.extensions.api.edit.location.live.stopLiveLocation
|
import dev.inmo.tgbotapi.extensions.api.edit.location.live.stopLiveLocation
|
||||||
|
import dev.inmo.tgbotapi.extensions.api.send.send
|
||||||
|
import dev.inmo.tgbotapi.extensions.api.send.sendLiveLocation
|
||||||
import dev.inmo.tgbotapi.requests.send.SendLiveLocation
|
import dev.inmo.tgbotapi.requests.send.SendLiveLocation
|
||||||
import dev.inmo.tgbotapi.types.*
|
import dev.inmo.tgbotapi.types.*
|
||||||
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
||||||
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
|
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
|
||||||
import dev.inmo.tgbotapi.types.chat.Chat
|
import dev.inmo.tgbotapi.types.chat.Chat
|
||||||
import dev.inmo.tgbotapi.types.location.LiveLocation
|
import dev.inmo.tgbotapi.types.location.LiveLocation
|
||||||
|
import dev.inmo.tgbotapi.types.location.Location
|
||||||
import dev.inmo.tgbotapi.types.location.StaticLocation
|
import dev.inmo.tgbotapi.types.location.StaticLocation
|
||||||
import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage
|
import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage
|
||||||
import dev.inmo.tgbotapi.types.message.abstracts.Message
|
import dev.inmo.tgbotapi.types.message.abstracts.Message
|
||||||
@ -18,7 +25,15 @@ import dev.inmo.tgbotapi.types.message.content.LocationContent
|
|||||||
import dev.inmo.tgbotapi.utils.extensions.threadIdOrNull
|
import dev.inmo.tgbotapi.utils.extensions.threadIdOrNull
|
||||||
import io.ktor.utils.io.core.Closeable
|
import io.ktor.utils.io.core.Closeable
|
||||||
import kotlinx.coroutines.CoroutineScope
|
import kotlinx.coroutines.CoroutineScope
|
||||||
|
import kotlinx.coroutines.CoroutineStart
|
||||||
|
import kotlinx.coroutines.currentCoroutineContext
|
||||||
|
import kotlinx.coroutines.delay
|
||||||
|
import kotlinx.coroutines.flow.Flow
|
||||||
|
import kotlinx.coroutines.flow.map
|
||||||
|
import kotlinx.coroutines.isActive
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
|
import kotlin.js.JsName
|
||||||
|
import kotlin.jvm.JvmName
|
||||||
import kotlin.math.ceil
|
import kotlin.math.ceil
|
||||||
|
|
||||||
val defaultLivePeriodDelayMillis = (livePeriodLimit.last - 60L) * 1000L
|
val defaultLivePeriodDelayMillis = (livePeriodLimit.last - 60L) * 1000L
|
||||||
@ -45,7 +60,8 @@ class LiveLocationProvider internal constructor(
|
|||||||
private set
|
private set
|
||||||
get() = field || leftUntilCloseMillis.millisecondsLong < 0L
|
get() = field || leftUntilCloseMillis.millisecondsLong < 0L
|
||||||
|
|
||||||
private var message: ContentMessage<LocationContent> = initMessage
|
var message: ContentMessage<LocationContent> = initMessage
|
||||||
|
private set
|
||||||
val lastLocation: LiveLocation
|
val lastLocation: LiveLocation
|
||||||
get() = message.content.location as LiveLocation
|
get() = message.content.location as LiveLocation
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user