mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI-examples.git
synced 2026-11-27 05:43:14 +00:00
update examples for ktgbotapi 38.0.0
This commit is contained in:
1 parent
d0da6c851b
commit
97b4391495
86 files changed
+888
-370
No files matched your search
@@ -17,7 +17,8 @@ In a private chat, `/start_test_topics` first checks the bot's `has_topics_enabl
|
||||
The bot replies to these service events:
|
||||
|
||||
- forum topic created or edited;
|
||||
- private topic created or edited;
|
||||
- private topic created or edited. The creation reply includes a link that reopens the topic in the user's private
|
||||
chat with the bot when Telegram supplies the thread ID;
|
||||
- forum topic reopened;
|
||||
- General topic hidden or unhidden.
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ buildscript {
|
||||
apply plugin: 'kotlin'
|
||||
apply plugin: 'application'
|
||||
|
||||
mainClassName="TopicsHandlingKt"
|
||||
application.mainClass = "TopicsHandlingKt"
|
||||
|
||||
|
||||
dependencies {
|
||||
|
||||
@@ -19,6 +19,8 @@ import dev.inmo.tgbotapi.extensions.behaviour_builder.triggers_handling.onGenera
|
||||
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.behaviour_builder.utils.botInfo
|
||||
import dev.inmo.tgbotapi.extensions.utils.formatting.link
|
||||
import dev.inmo.tgbotapi.extensions.utils.forumChatOrNull
|
||||
import dev.inmo.tgbotapi.extensions.utils.forumContentMessageOrNull
|
||||
import dev.inmo.tgbotapi.extensions.utils.privateChatOrNull
|
||||
@@ -193,8 +195,9 @@ suspend fun main(vararg args: String) {
|
||||
onForumTopicCreated {
|
||||
reply(it, "Topic has been created")
|
||||
}
|
||||
onPrivateForumTopicCreated {
|
||||
reply(it, "Private topic has been created")
|
||||
onPrivateForumTopicCreated { message ->
|
||||
val topicLink = message.chat.id.threadId?.let { thread -> botInfo()?.username?.link(thread) }
|
||||
reply(message, listOfNotNull("Private topic has been created", topicLink).joinToString("\n"))
|
||||
}
|
||||
|
||||
onForumTopicEdited {
|
||||
|
||||
Reference in new issue
Block a user