mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI-examples.git
synced 2024-12-22 00:27:19 +00:00
several fixes and improvements
This commit is contained in:
parent
41fc5a9a4c
commit
3a35995bc7
@ -7,6 +7,7 @@ import dev.inmo.tgbotapi.extensions.behaviour_builder.*
|
||||
import dev.inmo.tgbotapi.extensions.behaviour_builder.filters.CommonMessageFilterExcludeMediaGroups
|
||||
import dev.inmo.tgbotapi.extensions.behaviour_builder.filters.MessageFilterByChat
|
||||
import dev.inmo.tgbotapi.extensions.behaviour_builder.triggers_handling.*
|
||||
import dev.inmo.tgbotapi.extensions.utils.possiblyWithEffectMessageOrNull
|
||||
import dev.inmo.tgbotapi.extensions.utils.shortcuts.*
|
||||
import dev.inmo.tgbotapi.extensions.utils.withContentOrNull
|
||||
import dev.inmo.tgbotapi.types.ReplyParameters
|
||||
@ -39,7 +40,8 @@ suspend fun activateResenderBot(
|
||||
entities = quote ?.textSources ?: emptyList(),
|
||||
quotePosition = quote ?.position
|
||||
)
|
||||
}
|
||||
},
|
||||
effectId = it.possiblyWithEffectMessageOrNull() ?.effectId
|
||||
)
|
||||
) {
|
||||
it.forEach(print)
|
||||
|
@ -1,4 +1,5 @@
|
||||
import dev.inmo.micro_utils.coroutines.runCatchingSafely
|
||||
import dev.inmo.micro_utils.coroutines.subscribeSafelyWithoutExceptions
|
||||
import dev.inmo.tgbotapi.extensions.api.bot.getMe
|
||||
import dev.inmo.tgbotapi.extensions.api.files.downloadFile
|
||||
import dev.inmo.tgbotapi.extensions.api.files.downloadFileToTemp
|
||||
@ -77,10 +78,18 @@ suspend fun main(args: Array<String>) {
|
||||
runCatchingSafely {
|
||||
getStickerSet(stickerSetName)
|
||||
}.onSuccess { stickerSet ->
|
||||
addStickerToSet(it.chat.id.toChatId(), stickerSet.name, newSticker).also { _ ->
|
||||
runCatching {
|
||||
addStickerToSet(it.chat.id.toChatId(), stickerSet.name, newSticker).also { _ ->
|
||||
reply(
|
||||
it,
|
||||
getStickerSet(stickerSetName).stickers.last()
|
||||
)
|
||||
}
|
||||
}.onFailure { exception ->
|
||||
exception.printStackTrace()
|
||||
reply(
|
||||
it,
|
||||
getStickerSet(stickerSetName).stickers.last()
|
||||
"Unable to add sticker in stickerset"
|
||||
)
|
||||
}
|
||||
}.onFailure { exception ->
|
||||
@ -100,5 +109,9 @@ suspend fun main(args: Array<String>) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
allUpdatesFlow.subscribeSafelyWithoutExceptions(this) {
|
||||
println(it)
|
||||
}
|
||||
}.second.join()
|
||||
}
|
||||
|
@ -5,7 +5,7 @@ org.gradle.jvmargs=-Xmx2344m
|
||||
|
||||
|
||||
kotlin_version=1.9.23
|
||||
telegram_bot_api_version=13.0.0
|
||||
telegram_bot_api_version=14.0.0-branch_14.0.0-build2248
|
||||
micro_utils_version=0.20.45
|
||||
serialization_version=1.6.3
|
||||
ktor_version=2.3.10
|
||||
|
Loading…
Reference in New Issue
Block a user