1
0
mirror of https://github.com/InsanusMokrassar/TelegramBotAPI.git synced 2024-11-22 00:03:48 +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, 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
) )
} }