1
0
mirror of https://github.com/InsanusMokrassar/TelegramBotAPI.git synced 2024-11-25 03:28:44 +00:00

now it is possible to handle send content message in handleLiveLocation

This commit is contained in:
InsanusMokrassar 2023-02-17 15:31:40 +06:00
parent 7795bc2b50
commit 02b5d282d3

View File

@ -45,7 +45,8 @@ suspend fun TelegramBot.handleLiveLocation(
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null
allowSendingWithoutReply: Boolean? = null,
sentMessageDeferred: CompletableDeferred<ContentMessage<LocationContent>>? = null
) {
var currentLiveLocationMessage: ContentMessage<LocationContent>? = null
val updateMessageJob = CoroutineScope(currentCoroutineContext().LinkedSupervisorJob()).launchSafelyWithoutExceptions(start = CoroutineStart.LAZY) {
@ -73,7 +74,9 @@ suspend fun TelegramBot.handleLiveLocation(
replyToMessageId,
allowSendingWithoutReply,
it.replyMarkup
)
).also {
sentMessageDeferred ?.complete(it)
}
} else {
edit(
capturedLiveLocationMessage,
@ -102,7 +105,8 @@ suspend fun TelegramBot.handleLiveLocation(
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null
allowSendingWithoutReply: Boolean? = null,
sentMessageDeferred: CompletableDeferred<ContentMessage<LocationContent>>? = null
) {
handleLiveLocation(
chatId,
@ -121,7 +125,8 @@ suspend fun TelegramBot.handleLiveLocation(
disableNotification,
protectContent,
replyToMessageId,
allowSendingWithoutReply
allowSendingWithoutReply,
sentMessageDeferred
)
}
@ -139,7 +144,8 @@ suspend fun TelegramBot.handleLiveLocation(
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null
allowSendingWithoutReply: Boolean? = null,
sentMessageDeferred: CompletableDeferred<ContentMessage<LocationContent>>? = null
) {
handleLiveLocation(
chatId,
@ -154,6 +160,7 @@ suspend fun TelegramBot.handleLiveLocation(
disableNotification,
protectContent,
replyToMessageId,
allowSendingWithoutReply
allowSendingWithoutReply,
sentMessageDeferred
)
}