From 0edaa281512716b52d7caffbdbf7a5817a807b78 Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Sun, 2 Jan 2022 12:06:32 +0600 Subject: [PATCH] several small updates --- RandomFileSenderBot/src/main/kotlin/RandomFileSenderBot.kt | 6 ++++-- .../ResenderBotLib/src/commonMain/kotlin/ResenderBot.kt | 5 +++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/RandomFileSenderBot/src/main/kotlin/RandomFileSenderBot.kt b/RandomFileSenderBot/src/main/kotlin/RandomFileSenderBot.kt index 03da081..29d0e42 100644 --- a/RandomFileSenderBot/src/main/kotlin/RandomFileSenderBot.kt +++ b/RandomFileSenderBot/src/main/kotlin/RandomFileSenderBot.kt @@ -45,11 +45,13 @@ suspend fun main(args: Array) { when (files.size) { 1 -> sendDocument( chat.id, - files.first().asMultipartFile() + files.first().asMultipartFile(), + protectContent = true ) else -> sendDocumentsGroup( chat, - files.map { InputMediaDocument(it.asMultipartFile()) } + files.map { InputMediaDocument(it.asMultipartFile()) }, + protectContent = true ) } } diff --git a/ResenderBot/ResenderBotLib/src/commonMain/kotlin/ResenderBot.kt b/ResenderBot/ResenderBotLib/src/commonMain/kotlin/ResenderBot.kt index 6b354a9..ba3a134 100644 --- a/ResenderBot/ResenderBotLib/src/commonMain/kotlin/ResenderBot.kt +++ b/ResenderBot/ResenderBotLib/src/commonMain/kotlin/ResenderBot.kt @@ -1,3 +1,4 @@ +import dev.inmo.micro_utils.coroutines.subscribeSafelyWithoutExceptions import dev.inmo.tgbotapi.extensions.api.bot.getMe import dev.inmo.tgbotapi.bot.Ktor.telegramBot import dev.inmo.tgbotapi.extensions.api.send.media.* @@ -33,5 +34,9 @@ suspend fun activateResenderBot( onDocumentsGroup { sendDocumentsGroup(it.chat!!, it.map { it.content.toMediaGroupMemberInputMedia() }) } + + allUpdatesFlow.subscribeSafelyWithoutExceptions(this) { + println(it) + } }.join() }