From 0432611f851b611876677e6db8d11f82532ca40e Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Mon, 16 Feb 2026 17:40:23 +0600 Subject: [PATCH] improve test bots --- .../src/commonMain/kotlin/ResenderBot.kt | 1 - .../src/main/kotlin/TopicsHandling.kt | 39 +++++++++++++++++++ 2 files changed, 39 insertions(+), 1 deletion(-) diff --git a/ResenderBot/ResenderBotLib/src/commonMain/kotlin/ResenderBot.kt b/ResenderBot/ResenderBotLib/src/commonMain/kotlin/ResenderBot.kt index e5ebe67..a4e3177 100644 --- a/ResenderBot/ResenderBotLib/src/commonMain/kotlin/ResenderBot.kt +++ b/ResenderBot/ResenderBotLib/src/commonMain/kotlin/ResenderBot.kt @@ -38,7 +38,6 @@ suspend fun activateResenderBot( executeUnsafe( it.content.createResend( chat.id, - messageThreadId = it.threadIdOrNull, replyParameters = it.replyInfo?.messageMeta?.let { meta -> val quote = it.withContentOrNull()?.content?.quote ReplyParameters( diff --git a/TopicsHandling/src/main/kotlin/TopicsHandling.kt b/TopicsHandling/src/main/kotlin/TopicsHandling.kt index 49c86ea..e31f406 100644 --- a/TopicsHandling/src/main/kotlin/TopicsHandling.kt +++ b/TopicsHandling/src/main/kotlin/TopicsHandling.kt @@ -11,6 +11,14 @@ import dev.inmo.tgbotapi.extensions.api.chat.forum.* import dev.inmo.tgbotapi.extensions.api.send.reply import dev.inmo.tgbotapi.extensions.behaviour_builder.telegramBotWithBehaviourAndLongPolling import dev.inmo.tgbotapi.extensions.behaviour_builder.triggers_handling.onCommand +import dev.inmo.tgbotapi.extensions.behaviour_builder.triggers_handling.onForumTopicClosed +import dev.inmo.tgbotapi.extensions.behaviour_builder.triggers_handling.onForumTopicCreated +import dev.inmo.tgbotapi.extensions.behaviour_builder.triggers_handling.onForumTopicEdited +import dev.inmo.tgbotapi.extensions.behaviour_builder.triggers_handling.onForumTopicReopened +import dev.inmo.tgbotapi.extensions.behaviour_builder.triggers_handling.onGeneralForumTopicHidden +import dev.inmo.tgbotapi.extensions.behaviour_builder.triggers_handling.onGeneralForumTopicUnhidden +import dev.inmo.tgbotapi.extensions.behaviour_builder.triggers_handling.onPrivateForumTopicCreated +import dev.inmo.tgbotapi.extensions.behaviour_builder.triggers_handling.onPrivateForumTopicEdited import dev.inmo.tgbotapi.extensions.utils.forumChatOrNull import dev.inmo.tgbotapi.extensions.utils.forumContentMessageOrNull import dev.inmo.tgbotapi.extensions.utils.privateChatOrNull @@ -168,9 +176,40 @@ suspend fun main(vararg args: String) { deleteForumTopic(chat, chat.id.threadId ?: return@onCommand) } + onCommand("unpin_all_forum_topic_messages") { + val chat = it.chat.forumChatOrNull() ?: return@onCommand + + unpinAllForumTopicMessages(chat, chat.id.threadId ?: return@onCommand) + } + + onForumTopicCreated { + reply(it, "Topic has been created") + } + onPrivateForumTopicCreated { + reply(it, "Private topic has been created") + } + + onForumTopicEdited { + reply(it, "Topic has been edited") + } + onPrivateForumTopicEdited { + reply(it, "Private topic has been edited") + } + + onForumTopicReopened { + reply(it, "Topic has been reopened") + } + onGeneralForumTopicHidden { + reply(it, "General topic has been hidden") + } + onGeneralForumTopicUnhidden { + reply(it, "General topic has been unhidden") + } + setMyCommands( BotCommand("start_test_topics", "start test topics"), BotCommand("delete_topic", "delete topic where message have been sent"), + BotCommand("unpin_all_forum_topic_messages", "delete topic where message have been sent"), scope = BotCommandScope.AllGroupChats ) allUpdatesFlow.subscribeLoggingDropExceptions(this) {