diff --git a/ForwarderBot/src/main/kotlin/ForwarderBot.kt b/ForwarderBot/src/main/kotlin/ForwarderBot.kt index d30f051..843fa8e 100644 --- a/ForwarderBot/src/main/kotlin/ForwarderBot.kt +++ b/ForwarderBot/src/main/kotlin/ForwarderBot.kt @@ -1,8 +1,10 @@ import dev.inmo.tgbotapi.extensions.api.send.sendTextMessage import dev.inmo.tgbotapi.extensions.api.telegramBot +import dev.inmo.tgbotapi.extensions.utils.flatMap import dev.inmo.tgbotapi.extensions.utils.formatting.codeMarkdownV2 import dev.inmo.tgbotapi.extensions.utils.formatting.regularMarkdownV2 import dev.inmo.tgbotapi.extensions.utils.safely +import dev.inmo.tgbotapi.extensions.utils.shortcuts.mediaGroupMessages import dev.inmo.tgbotapi.extensions.utils.updates.asContentMessagesFlow import dev.inmo.tgbotapi.extensions.utils.updates.retrieving.startGettingFlowsUpdatesByLongPolling import dev.inmo.tgbotapi.types.ParseMode.MarkdownV2 @@ -23,7 +25,7 @@ suspend fun main(vararg args: String) { val scope = CoroutineScope(Dispatchers.Default) bot.startGettingFlowsUpdatesByLongPolling(scope = scope) { - messageFlow.asContentMessagesFlow().mapNotNull { it as? PossiblyForwardedMessage }.onEach { message -> + (merge(messageFlow.asContentMessagesFlow(), mediaGroupMessages(scope).flatMap())).mapNotNull { it as? PossiblyForwardedMessage }.onEach { message -> safely({ it.printStackTrace() }) { val toAnswer = when (val forwardInfo = message.forwardInfo) { null -> "There is no forward info" diff --git a/gradle.properties b/gradle.properties index 0320b09..ce1aa01 100644 --- a/gradle.properties +++ b/gradle.properties @@ -2,4 +2,4 @@ kotlin.code.style=official org.gradle.parallel=true kotlin_version=1.4.10 -telegram_bot_api_version=0.29.2 +telegram_bot_api_version=0.29.3