diff --git a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/LiveFlowLocation.kt b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/LiveFlowLocation.kt index aa168e30d1..cc4c1e14bf 100644 --- a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/LiveFlowLocation.kt +++ b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/LiveFlowLocation.kt @@ -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>? = null ) { var currentLiveLocationMessage: ContentMessage? = 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>? = 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>? = null ) { handleLiveLocation( chatId, @@ -154,6 +160,7 @@ suspend fun TelegramBot.handleLiveLocation( disableNotification, protectContent, replyToMessageId, - allowSendingWithoutReply + allowSendingWithoutReply, + sentMessageDeferred ) }