mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI-examples.git
synced 2025-12-05 05:45:39 +00:00
Compare commits
11 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| f7ba9892c8 | |||
| f87a9c5c66 | |||
| a7b54e4b63 | |||
|
|
436213492d | ||
|
|
0c2110a71d | ||
| 949fa1a429 | |||
| 97cdd5a95f | |||
|
|
0cb116acef | ||
|
|
a0332c4efd | ||
| f6bce640da | |||
| d22a99da19 |
@@ -7,11 +7,13 @@ import dev.inmo.tgbotapi.extensions.behaviour_builder.triggers_handling.onConten
|
||||
import dev.inmo.tgbotapi.extensions.behaviour_builder.triggers_handling.onMentionWithAnyContent
|
||||
import dev.inmo.tgbotapi.extensions.utils.extensions.raw.sender_chat
|
||||
import dev.inmo.tgbotapi.extensions.utils.extensions.raw.text
|
||||
import dev.inmo.tgbotapi.extensions.utils.formatting.chatLink
|
||||
import dev.inmo.tgbotapi.extensions.utils.formatting.linkMarkdownV2
|
||||
import dev.inmo.tgbotapi.extensions.utils.formatting.textMentionMarkdownV2
|
||||
import dev.inmo.tgbotapi.extensions.utils.ifFromChannelGroupContentMessage
|
||||
import dev.inmo.tgbotapi.types.chat.*
|
||||
import dev.inmo.tgbotapi.types.message.MarkdownV2
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.ForumContentMessage
|
||||
import dev.inmo.tgbotapi.utils.PreviewFeature
|
||||
import dev.inmo.tgbotapi.utils.extensions.escapeMarkdownV2Common
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
@@ -56,8 +58,17 @@ suspend fun main(vararg args: String) {
|
||||
reply(message, answer, MarkdownV2)
|
||||
return@onContentMessage
|
||||
}
|
||||
"Oh, hi, " + when (chat) {
|
||||
is SupergroupChat -> (chat.username ?.username ?: getChat(chat).inviteLink) ?.let {
|
||||
"Oh, hi, " + when {
|
||||
chat is ForumChat && message is ForumContentMessage<*> -> {
|
||||
val baseTitle = (chat.username ?.username ?: getChat(chat).inviteLink) ?.let {
|
||||
chat.title.linkMarkdownV2(it)
|
||||
} ?: chat.title
|
||||
val additionalTitle = message.threadCreatingInfo ?.let {
|
||||
it.name.linkMarkdownV2(message.chat.id.chatLink)
|
||||
} ?: "Main topic"
|
||||
"$baseTitle \\($additionalTitle\\)"
|
||||
}
|
||||
chat is SupergroupChat -> (chat.username ?.username ?: getChat(chat).inviteLink) ?.let {
|
||||
chat.title.linkMarkdownV2(it)
|
||||
} ?: chat.title
|
||||
else -> bot.getChat(chat).inviteLink ?.let {
|
||||
|
||||
@@ -33,6 +33,6 @@ kotlin {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation 'io.ktor:ktor-client-logging-jvm:3.0.3'
|
||||
implementation 'io.ktor:ktor-client-logging-jvm:3.1.0'
|
||||
}
|
||||
|
||||
|
||||
@@ -18,5 +18,5 @@ dependencies {
|
||||
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
||||
|
||||
implementation "dev.inmo:tgbotapi:$telegram_bot_api_version"
|
||||
implementation 'io.ktor:ktor-client-logging-jvm:3.0.3'
|
||||
implementation 'io.ktor:ktor-client-logging-jvm:3.1.0'
|
||||
}
|
||||
|
||||
@@ -5,9 +5,9 @@ org.gradle.jvmargs=-Xmx3148m
|
||||
kotlin.daemon.jvmargs=-Xmx3g -Xms500m
|
||||
|
||||
|
||||
kotlin_version=2.1.0
|
||||
telegram_bot_api_version=23.1.1
|
||||
micro_utils_version=0.24.4
|
||||
kotlin_version=2.1.10
|
||||
telegram_bot_api_version=24.0.0
|
||||
micro_utils_version=0.24.6
|
||||
serialization_version=1.8.0
|
||||
ktor_version=3.0.3
|
||||
ktor_version=3.1.0
|
||||
compose_version=1.7.3
|
||||
|
||||
Reference in New Issue
Block a user