From 00ab078891a1284f5ae6ab78a6a262bd1f916435 Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Sat, 18 Apr 2026 18:40:16 +0600 Subject: [PATCH] build fix --- .../src/main/kotlin/BusinessConnectionsBot.kt | 16 ++++++++++++++++ .../src/main/kotlin/ChatAvatarSetter.kt | 11 ++++------- MyBot/src/main/kotlin/MyBot.kt | 11 ++++------- PollsBot/src/main/kotlin/PollsBot.kt | 2 +- .../src/main/kotlin/StickerSetHandlerBot.kt | 6 +++++- 5 files changed, 30 insertions(+), 16 deletions(-) diff --git a/BusinessConnectionsBot/src/main/kotlin/BusinessConnectionsBot.kt b/BusinessConnectionsBot/src/main/kotlin/BusinessConnectionsBot.kt index 41a9710..24ef4cf 100644 --- a/BusinessConnectionsBot/src/main/kotlin/BusinessConnectionsBot.kt +++ b/BusinessConnectionsBot/src/main/kotlin/BusinessConnectionsBot.kt @@ -213,6 +213,8 @@ suspend fun main(args: Array) { firstName, secondName ) + }.map { + true }.getOrElse { false } reply(it) { if (set) { @@ -230,6 +232,8 @@ suspend fun main(args: Array) { businessConnectionId, username ) + }.map { + true }.getOrElse { it.printStackTrace() false @@ -267,6 +271,8 @@ suspend fun main(args: Array) { } val transferred = runCatching { transferBusinessAccountStars(businessConnectionId, count) + }.map { + true }.getOrElse { it.printStackTrace() false @@ -310,6 +316,8 @@ suspend fun main(args: Array) { businessConnectionId, bio ) + }.map { + true }.getOrElse { it.printStackTrace() false @@ -327,6 +335,8 @@ suspend fun main(args: Array) { businessConnectionId, initialBio ) + }.map { + true }.getOrElse { it.printStackTrace() false @@ -358,6 +368,8 @@ suspend fun main(args: Array) { ), isPublic = isPublic ) + }.map { + true }.getOrElse { it.printStackTrace() false @@ -376,6 +388,8 @@ suspend fun main(args: Array) { businessConnectionId, isPublic = isPublic ) + }.map { + true }.getOrElse { it.printStackTrace() false @@ -461,6 +475,8 @@ suspend fun main(args: Array) { val deleted = runCatching { deleteStory(businessConnectionId, replyTo.content.story.id) + }.map { + true }.getOrElse { it.printStackTrace() false diff --git a/ChatAvatarSetter/src/main/kotlin/ChatAvatarSetter.kt b/ChatAvatarSetter/src/main/kotlin/ChatAvatarSetter.kt index 0c0a4f6..7447349 100644 --- a/ChatAvatarSetter/src/main/kotlin/ChatAvatarSetter.kt +++ b/ChatAvatarSetter/src/main/kotlin/ChatAvatarSetter.kt @@ -1,3 +1,4 @@ +import dev.inmo.micro_utils.coroutines.runCatchingLogging import dev.inmo.micro_utils.coroutines.runCatchingSafely import dev.inmo.tgbotapi.bot.ktor.telegramBot import dev.inmo.tgbotapi.extensions.api.chat.modify.setChatPhoto @@ -15,17 +16,13 @@ suspend fun main(args: Array) { bot.buildBehaviourWithLongPolling(scope = CoroutineScope(Dispatchers.IO)) { onPhoto { val bytes = downloadFile(it.content) - runCatchingSafely { + runCatchingLogging { setChatPhoto( it.chat.id, bytes.asMultipartFile("sample.jpg") ) - }.onSuccess { b -> - if (b) { - reply(it, "Done") - } else { - reply(it, "Something went wrong") - } + }.onSuccess { _ -> + reply(it, "Done") }.onFailure { e -> e.printStackTrace() diff --git a/MyBot/src/main/kotlin/MyBot.kt b/MyBot/src/main/kotlin/MyBot.kt index a6f5150..eda28e7 100644 --- a/MyBot/src/main/kotlin/MyBot.kt +++ b/MyBot/src/main/kotlin/MyBot.kt @@ -70,21 +70,18 @@ suspend fun main(vararg args: String) { draftMessagesChannel.send("Photo file have been downloaded. Start set my profile photo") - val setResult = setMyProfilePhoto( + setMyProfilePhoto( InputProfilePhoto.Static( photoFile.asMultipartFile() ) ) - if (setResult) { - reply(commandMessage, "New photo have been set") - } + reply(commandMessage, "New photo have been set") } onCommand("removeMyProfilePhoto") { runCatchingLogging { - if (removeMyProfilePhoto()) { - reply(it, "Photo have been removed") - } + removeMyProfilePhoto() + reply(it, "Photo have been removed") }.onFailure { e -> e.printStackTrace() reply(it, "Something web wrong. See logs for details.") diff --git a/PollsBot/src/main/kotlin/PollsBot.kt b/PollsBot/src/main/kotlin/PollsBot.kt index 58eb602..e4e27db 100644 --- a/PollsBot/src/main/kotlin/PollsBot.kt +++ b/PollsBot/src/main/kotlin/PollsBot.kt @@ -156,7 +156,7 @@ suspend fun main(vararg args: String) { isAnonymous = false, replyParameters = ReplyParameters(it), correctOptionIds = correctAnswer.sorted(), - allowMultipleAnswers = correctAnswer.size > 1, + allowsMultipleAnswers = correctAnswer.size > 1, allowsRevoting = true, shuffleOptions = true, hideResultsUntilCloses = true, diff --git a/StickerSetHandler/src/main/kotlin/StickerSetHandlerBot.kt b/StickerSetHandler/src/main/kotlin/StickerSetHandlerBot.kt index 875a1a5..ed8bac8 100644 --- a/StickerSetHandler/src/main/kotlin/StickerSetHandlerBot.kt +++ b/StickerSetHandler/src/main/kotlin/StickerSetHandlerBot.kt @@ -44,7 +44,11 @@ suspend fun main(args: Array) { onCommand("delete") { val deleted = runCatchingSafely { deleteStickerSet(it.chat.stickerSetName()) - }.getOrElse { false } + }.map { + true + }.getOrElse { + false + } if (deleted) { reply(it, "Deleted")