Compare commits

..

3 Commits

Author SHA1 Message Date
renovate[bot]
e477d3ca2e Update telegram_bot_api_version to v33.1.0 2026-04-19 08:53:41 +00:00
89e1eec53e Merge pull request #358 from InsanusMokrassar/33.0.0
33.0.0
2026-04-18 19:34:46 +06:00
00ab078891 build fix 2026-04-18 18:40:16 +06:00
6 changed files with 31 additions and 17 deletions

View File

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

View File

@@ -1,3 +1,4 @@
import dev.inmo.micro_utils.coroutines.runCatchingLogging
import dev.inmo.micro_utils.coroutines.runCatchingSafely import dev.inmo.micro_utils.coroutines.runCatchingSafely
import dev.inmo.tgbotapi.bot.ktor.telegramBot import dev.inmo.tgbotapi.bot.ktor.telegramBot
import dev.inmo.tgbotapi.extensions.api.chat.modify.setChatPhoto 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)) { bot.buildBehaviourWithLongPolling(scope = CoroutineScope(Dispatchers.IO)) {
onPhoto { onPhoto {
val bytes = downloadFile(it.content) val bytes = downloadFile(it.content)
runCatchingSafely { runCatchingLogging {
setChatPhoto( setChatPhoto(
it.chat.id, it.chat.id,
bytes.asMultipartFile("sample.jpg") bytes.asMultipartFile("sample.jpg")
) )
}.onSuccess { b -> }.onSuccess { _ ->
if (b) { reply(it, "Done")
reply(it, "Done")
} else {
reply(it, "Something went wrong")
}
}.onFailure { e -> }.onFailure { e ->
e.printStackTrace() 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") draftMessagesChannel.send("Photo file have been downloaded. Start set my profile photo")
val setResult = setMyProfilePhoto( setMyProfilePhoto(
InputProfilePhoto.Static( InputProfilePhoto.Static(
photoFile.asMultipartFile() photoFile.asMultipartFile()
) )
) )
if (setResult) { reply(commandMessage, "New photo have been set")
reply(commandMessage, "New photo have been set")
}
} }
onCommand("removeMyProfilePhoto") { onCommand("removeMyProfilePhoto") {
runCatchingLogging { runCatchingLogging {
if (removeMyProfilePhoto()) { removeMyProfilePhoto()
reply(it, "Photo have been removed") reply(it, "Photo have been removed")
}
}.onFailure { e -> }.onFailure { e ->
e.printStackTrace() e.printStackTrace()
reply(it, "Something web wrong. See logs for details.") reply(it, "Something web wrong. See logs for details.")

View File

@@ -156,7 +156,7 @@ suspend fun main(vararg args: String) {
isAnonymous = false, isAnonymous = false,
replyParameters = ReplyParameters(it), replyParameters = ReplyParameters(it),
correctOptionIds = correctAnswer.sorted(), correctOptionIds = correctAnswer.sorted(),
allowMultipleAnswers = correctAnswer.size > 1, allowsMultipleAnswers = correctAnswer.size > 1,
allowsRevoting = true, allowsRevoting = true,
shuffleOptions = true, shuffleOptions = true,
hideResultsUntilCloses = true, hideResultsUntilCloses = true,

View File

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

View File

@@ -6,7 +6,7 @@ kotlin.daemon.jvmargs=-Xmx3g -Xms500m
kotlin_version=2.3.20 kotlin_version=2.3.20
telegram_bot_api_version=33.0.0 telegram_bot_api_version=33.1.0
micro_utils_version=0.29.1 micro_utils_version=0.29.1
serialization_version=1.10.0 serialization_version=1.10.0
ktor_version=3.4.1 ktor_version=3.4.1