diff --git a/FSMBot/src/main/kotlin/SimpleFSMBot.kt b/FSMBot/src/main/kotlin/SimpleFSMBot.kt index 53ee72a..ca3f0b2 100644 --- a/FSMBot/src/main/kotlin/SimpleFSMBot.kt +++ b/FSMBot/src/main/kotlin/SimpleFSMBot.kt @@ -1,5 +1,6 @@ import dev.inmo.micro_utils.coroutines.AccumulatorFlow import dev.inmo.micro_utils.fsm.common.State +import dev.inmo.tgbotapi.extensions.api.send.send import dev.inmo.tgbotapi.extensions.api.send.sendMessage import dev.inmo.tgbotapi.extensions.behaviour_builder.* import dev.inmo.tgbotapi.extensions.behaviour_builder.expectations.* @@ -55,7 +56,7 @@ suspend fun main(args: Array) { } } strictlyOn { - sendMessage(it.context, "You have stopped sending of content") + send(it.context, "You have stopped sending of content") null } diff --git a/HelloBot/src/main/kotlin/HelloBot.kt b/HelloBot/src/main/kotlin/HelloBot.kt index f960424..50515e1 100644 --- a/HelloBot/src/main/kotlin/HelloBot.kt +++ b/HelloBot/src/main/kotlin/HelloBot.kt @@ -1,7 +1,6 @@ import dev.inmo.micro_utils.coroutines.subscribeSafelyWithoutExceptions import dev.inmo.tgbotapi.extensions.api.chat.get.getChat -import dev.inmo.tgbotapi.extensions.api.send.reply -import dev.inmo.tgbotapi.extensions.api.send.sendTextMessage +import dev.inmo.tgbotapi.extensions.api.send.* import dev.inmo.tgbotapi.extensions.behaviour_builder.telegramBotWithBehaviourAndLongPolling import dev.inmo.tgbotapi.extensions.behaviour_builder.triggers_handling.onContentMessage import dev.inmo.tgbotapi.extensions.utils.formatting.linkMarkdownV2 @@ -27,7 +26,7 @@ suspend fun main(vararg args: String) { val chat = message.chat if (chat is ChannelChat) { val answer = "Hi everybody in this channel \"${chat.title}\"" - sendTextMessage(chat, answer, MarkdownV2) + send(chat, answer, MarkdownV2) return@onContentMessage } val answerText = "Oh, hi, " + when (chat) { diff --git a/KeyboardsBot/KeyboardsBotLib/src/commonMain/kotlin/KeyboardsBot.kt b/KeyboardsBot/KeyboardsBotLib/src/commonMain/kotlin/KeyboardsBot.kt index a4a1115..a698ec2 100644 --- a/KeyboardsBot/KeyboardsBotLib/src/commonMain/kotlin/KeyboardsBot.kt +++ b/KeyboardsBot/KeyboardsBotLib/src/commonMain/kotlin/KeyboardsBot.kt @@ -3,6 +3,7 @@ import dev.inmo.tgbotapi.extensions.api.bot.getMe import dev.inmo.tgbotapi.bot.ktor.telegramBot import dev.inmo.tgbotapi.extensions.api.answers.answer import dev.inmo.tgbotapi.extensions.api.bot.setMyCommands +import dev.inmo.tgbotapi.extensions.api.edit.common.edit import dev.inmo.tgbotapi.extensions.api.edit.text.editMessageText import dev.inmo.tgbotapi.extensions.api.send.* import dev.inmo.tgbotapi.extensions.behaviour_builder.* @@ -88,7 +89,7 @@ suspend fun activateKeyboardsBot( val text = "This is $page of $count" - editMessageText( + edit( it.message.withContent() ?: it.let { answer(it, "Unsupported message type :(") return@onMessageDataCallbackQuery diff --git a/RandomFileSenderBot/src/main/kotlin/RandomFileSenderBot.kt b/RandomFileSenderBot/src/main/kotlin/RandomFileSenderBot.kt index ab56fe1..302200e 100644 --- a/RandomFileSenderBot/src/main/kotlin/RandomFileSenderBot.kt +++ b/RandomFileSenderBot/src/main/kotlin/RandomFileSenderBot.kt @@ -3,15 +3,15 @@ import dev.inmo.tgbotapi.bot.ktor.telegramBot import dev.inmo.tgbotapi.bot.TelegramBot import dev.inmo.tgbotapi.extensions.api.bot.getMe import dev.inmo.tgbotapi.extensions.api.bot.setMyCommands +import dev.inmo.tgbotapi.extensions.api.send.* import dev.inmo.tgbotapi.extensions.api.send.media.sendDocument import dev.inmo.tgbotapi.extensions.api.send.media.sendDocumentsGroup -import dev.inmo.tgbotapi.extensions.api.send.reply -import dev.inmo.tgbotapi.extensions.api.send.withUploadDocumentAction import dev.inmo.tgbotapi.extensions.behaviour_builder.buildBehaviourWithLongPolling import dev.inmo.tgbotapi.extensions.behaviour_builder.triggers_handling.onCommandWithArgs import dev.inmo.tgbotapi.requests.abstracts.asMultipartFile import dev.inmo.tgbotapi.types.BotCommand import dev.inmo.tgbotapi.types.chat.Chat +import dev.inmo.tgbotapi.types.files.DocumentFile import dev.inmo.tgbotapi.types.media.TelegramMediaDocument import dev.inmo.tgbotapi.types.mediaCountInMediaGroup import java.io.File @@ -81,7 +81,7 @@ suspend fun main(args: Array) { } if (!sent) { - bot.reply(message, "Nothing selected :(") + reply(message, "Nothing selected :(") } } } diff --git a/ResenderBot/ResenderBotLib/src/commonMain/kotlin/ResenderBot.kt b/ResenderBot/ResenderBotLib/src/commonMain/kotlin/ResenderBot.kt index eade287..5791db6 100644 --- a/ResenderBot/ResenderBotLib/src/commonMain/kotlin/ResenderBot.kt +++ b/ResenderBot/ResenderBotLib/src/commonMain/kotlin/ResenderBot.kt @@ -31,19 +31,19 @@ suspend fun activateResenderBot( onVisualGallery { val chat = it.chat ?: return@onVisualGallery withUploadPhotoAction(chat) { - sendVisualMediaGroup(chat, it.map { it.content.toMediaGroupMemberTelegramMedia() }) + send(chat, it.map { it.content.toMediaGroupMemberTelegramMedia() }) } } onPlaylist { val chat = it.chat ?: return@onPlaylist withUploadDocumentAction(chat) { - sendPlaylist(chat, it.map { it.content.toMediaGroupMemberTelegramMedia() }) + send(chat, it.map { it.content.toMediaGroupMemberTelegramMedia() }) } } onDocumentsGroup { val chat = it.chat ?: return@onDocumentsGroup withUploadDocumentAction(chat) { - sendDocumentsGroup(chat, it.map { it.content.toMediaGroupMemberTelegramMedia() }) + send(chat, it.map { it.content.toMediaGroupMemberTelegramMedia() }) } } diff --git a/SlotMachineDetectorBot/src/main/kotlin/SlotMachineDetectorBot.kt b/SlotMachineDetectorBot/src/main/kotlin/SlotMachineDetectorBot.kt index 2720ec1..075e37d 100644 --- a/SlotMachineDetectorBot/src/main/kotlin/SlotMachineDetectorBot.kt +++ b/SlotMachineDetectorBot/src/main/kotlin/SlotMachineDetectorBot.kt @@ -17,9 +17,9 @@ suspend fun main(args: Array) { if (diceType == SlotMachineDiceAnimationType) { val result = dice.calculateSlotMachineResult() ?: return@onDice - bot.reply(it, "${result.leftReel}|${result.centerReel}|${result.rightReel}") + reply(it, "${result.leftReel}|${result.centerReel}|${result.rightReel}") } else { - bot.reply(it, "There is no slot machine dice in message") + reply(it, "There is no slot machine dice in message") } } }.join() diff --git a/gradle.properties b/gradle.properties index 49e16f5..02fb89f 100644 --- a/gradle.properties +++ b/gradle.properties @@ -5,7 +5,7 @@ org.gradle.jvmargs=-Xmx768m kotlin_version=1.6.21 -telegram_bot_api_version=2.1.0 +telegram_bot_api_version=2.1.1 micro_utils_version=0.11.6 serialization_version=1.3.3 ktor_version=2.0.2