Skip to content

Commit 0432611

Browse files
improve test bots
1 parent 6b27aa0 commit 0432611

File tree

2 files changed

+39
-1
lines changed

2 files changed

+39
-1
lines changed

ResenderBot/ResenderBotLib/src/commonMain/kotlin/ResenderBot.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ suspend fun activateResenderBot(
3838
executeUnsafe(
3939
it.content.createResend(
4040
chat.id,
41-
messageThreadId = it.threadIdOrNull,
4241
replyParameters = it.replyInfo?.messageMeta?.let { meta ->
4342
val quote = it.withContentOrNull<TextContent>()?.content?.quote
4443
ReplyParameters(

TopicsHandling/src/main/kotlin/TopicsHandling.kt

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,14 @@ import dev.inmo.tgbotapi.extensions.api.chat.forum.*
1111
import dev.inmo.tgbotapi.extensions.api.send.reply
1212
import dev.inmo.tgbotapi.extensions.behaviour_builder.telegramBotWithBehaviourAndLongPolling
1313
import dev.inmo.tgbotapi.extensions.behaviour_builder.triggers_handling.onCommand
14+
import dev.inmo.tgbotapi.extensions.behaviour_builder.triggers_handling.onForumTopicClosed
15+
import dev.inmo.tgbotapi.extensions.behaviour_builder.triggers_handling.onForumTopicCreated
16+
import dev.inmo.tgbotapi.extensions.behaviour_builder.triggers_handling.onForumTopicEdited
17+
import dev.inmo.tgbotapi.extensions.behaviour_builder.triggers_handling.onForumTopicReopened
18+
import dev.inmo.tgbotapi.extensions.behaviour_builder.triggers_handling.onGeneralForumTopicHidden
19+
import dev.inmo.tgbotapi.extensions.behaviour_builder.triggers_handling.onGeneralForumTopicUnhidden
20+
import dev.inmo.tgbotapi.extensions.behaviour_builder.triggers_handling.onPrivateForumTopicCreated
21+
import dev.inmo.tgbotapi.extensions.behaviour_builder.triggers_handling.onPrivateForumTopicEdited
1422
import dev.inmo.tgbotapi.extensions.utils.forumChatOrNull
1523
import dev.inmo.tgbotapi.extensions.utils.forumContentMessageOrNull
1624
import dev.inmo.tgbotapi.extensions.utils.privateChatOrNull
@@ -168,9 +176,40 @@ suspend fun main(vararg args: String) {
168176
deleteForumTopic(chat, chat.id.threadId ?: return@onCommand)
169177
}
170178

179+
onCommand("unpin_all_forum_topic_messages") {
180+
val chat = it.chat.forumChatOrNull() ?: return@onCommand
181+
182+
unpinAllForumTopicMessages(chat, chat.id.threadId ?: return@onCommand)
183+
}
184+
185+
onForumTopicCreated {
186+
reply(it, "Topic has been created")
187+
}
188+
onPrivateForumTopicCreated {
189+
reply(it, "Private topic has been created")
190+
}
191+
192+
onForumTopicEdited {
193+
reply(it, "Topic has been edited")
194+
}
195+
onPrivateForumTopicEdited {
196+
reply(it, "Private topic has been edited")
197+
}
198+
199+
onForumTopicReopened {
200+
reply(it, "Topic has been reopened")
201+
}
202+
onGeneralForumTopicHidden {
203+
reply(it, "General topic has been hidden")
204+
}
205+
onGeneralForumTopicUnhidden {
206+
reply(it, "General topic has been unhidden")
207+
}
208+
171209
setMyCommands(
172210
BotCommand("start_test_topics", "start test topics"),
173211
BotCommand("delete_topic", "delete topic where message have been sent"),
212+
BotCommand("unpin_all_forum_topic_messages", "delete topic where message have been sent"),
174213
scope = BotCommandScope.AllGroupChats
175214
)
176215
allUpdatesFlow.subscribeLoggingDropExceptions(this) {

0 commit comments

Comments
 (0)