mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2024-11-22 00:03:48 +00:00
hotfix in LiveFlowLocation
This commit is contained in:
parent
02b5d282d3
commit
fa0a2818a0
@ -6,7 +6,6 @@ import dev.inmo.tgbotapi.abstracts.*
|
|||||||
import dev.inmo.tgbotapi.abstracts.types.WithReplyMarkup
|
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.edit
|
||||||
import dev.inmo.tgbotapi.extensions.api.edit.location.live.editLiveLocation
|
|
||||||
import dev.inmo.tgbotapi.extensions.api.send.send
|
import dev.inmo.tgbotapi.extensions.api.send.send
|
||||||
import dev.inmo.tgbotapi.extensions.api.send.sendLiveLocation
|
import dev.inmo.tgbotapi.extensions.api.send.sendLiveLocation
|
||||||
import dev.inmo.tgbotapi.types.*
|
import dev.inmo.tgbotapi.types.*
|
||||||
@ -17,6 +16,7 @@ import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage
|
|||||||
import dev.inmo.tgbotapi.types.message.content.LocationContent
|
import dev.inmo.tgbotapi.types.message.content.LocationContent
|
||||||
import kotlinx.coroutines.*
|
import kotlinx.coroutines.*
|
||||||
import kotlinx.coroutines.flow.Flow
|
import kotlinx.coroutines.flow.Flow
|
||||||
|
import kotlinx.coroutines.flow.FlowCollector
|
||||||
import kotlinx.coroutines.flow.map
|
import kotlinx.coroutines.flow.map
|
||||||
import kotlinx.serialization.Serializable
|
import kotlinx.serialization.Serializable
|
||||||
import kotlin.js.JsName
|
import kotlin.js.JsName
|
||||||
@ -46,7 +46,7 @@ suspend fun TelegramBot.handleLiveLocation(
|
|||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageId? = null,
|
replyToMessageId: MessageId? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
sentMessageDeferred: CompletableDeferred<ContentMessage<LocationContent>>? = null
|
sentMessageFlow: FlowCollector<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) {
|
||||||
@ -75,7 +75,7 @@ suspend fun TelegramBot.handleLiveLocation(
|
|||||||
allowSendingWithoutReply,
|
allowSendingWithoutReply,
|
||||||
it.replyMarkup
|
it.replyMarkup
|
||||||
).also {
|
).also {
|
||||||
sentMessageDeferred ?.complete(it)
|
sentMessageFlow ?.emit(it)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
edit(
|
edit(
|
||||||
@ -106,7 +106,7 @@ suspend fun TelegramBot.handleLiveLocation(
|
|||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageId? = null,
|
replyToMessageId: MessageId? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
sentMessageDeferred: CompletableDeferred<ContentMessage<LocationContent>>? = null
|
sentMessageFlow: FlowCollector<ContentMessage<LocationContent>>? = null
|
||||||
) {
|
) {
|
||||||
handleLiveLocation(
|
handleLiveLocation(
|
||||||
chatId,
|
chatId,
|
||||||
@ -126,7 +126,7 @@ suspend fun TelegramBot.handleLiveLocation(
|
|||||||
protectContent,
|
protectContent,
|
||||||
replyToMessageId,
|
replyToMessageId,
|
||||||
allowSendingWithoutReply,
|
allowSendingWithoutReply,
|
||||||
sentMessageDeferred
|
sentMessageFlow
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -145,7 +145,7 @@ suspend fun TelegramBot.handleLiveLocation(
|
|||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageId? = null,
|
replyToMessageId: MessageId? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
sentMessageDeferred: CompletableDeferred<ContentMessage<LocationContent>>? = null
|
sentMessageFlow: FlowCollector<ContentMessage<LocationContent>>? = null
|
||||||
) {
|
) {
|
||||||
handleLiveLocation(
|
handleLiveLocation(
|
||||||
chatId,
|
chatId,
|
||||||
@ -161,6 +161,6 @@ suspend fun TelegramBot.handleLiveLocation(
|
|||||||
protectContent,
|
protectContent,
|
||||||
replyToMessageId,
|
replyToMessageId,
|
||||||
allowSendingWithoutReply,
|
allowSendingWithoutReply,
|
||||||
sentMessageDeferred
|
sentMessageFlow
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user