build fix

This commit is contained in:
2026-04-18 18:40:16 +06:00
parent bd71e642b2
commit 00ab078891
5 changed files with 30 additions and 16 deletions

View File

@@ -213,6 +213,8 @@ suspend fun main(args: Array<String>) {
firstName,
secondName
)
}.map {
true
}.getOrElse { false }
reply(it) {
if (set) {
@@ -230,6 +232,8 @@ suspend fun main(args: Array<String>) {
businessConnectionId,
username
)
}.map {
true
}.getOrElse {
it.printStackTrace()
false
@@ -267,6 +271,8 @@ suspend fun main(args: Array<String>) {
}
val transferred = runCatching {
transferBusinessAccountStars(businessConnectionId, count)
}.map {
true
}.getOrElse {
it.printStackTrace()
false
@@ -310,6 +316,8 @@ suspend fun main(args: Array<String>) {
businessConnectionId,
bio
)
}.map {
true
}.getOrElse {
it.printStackTrace()
false
@@ -327,6 +335,8 @@ suspend fun main(args: Array<String>) {
businessConnectionId,
initialBio
)
}.map {
true
}.getOrElse {
it.printStackTrace()
false
@@ -358,6 +368,8 @@ suspend fun main(args: Array<String>) {
),
isPublic = isPublic
)
}.map {
true
}.getOrElse {
it.printStackTrace()
false
@@ -376,6 +388,8 @@ suspend fun main(args: Array<String>) {
businessConnectionId,
isPublic = isPublic
)
}.map {
true
}.getOrElse {
it.printStackTrace()
false
@@ -461,6 +475,8 @@ suspend fun main(args: Array<String>) {
val deleted = runCatching {
deleteStory(businessConnectionId, replyTo.content.story.id)
}.map {
true
}.getOrElse {
it.printStackTrace()
false

View File

@@ -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<String>) {
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()

View File

@@ -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.")

View File

@@ -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,

View File

@@ -44,7 +44,11 @@ suspend fun main(args: Array<String>) {
onCommand("delete") {
val deleted = runCatchingSafely {
deleteStickerSet(it.chat.stickerSetName())
}.getOrElse { false }
}.map {
true
}.getOrElse {
false
}
if (deleted) {
reply(it, "Deleted")