mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI-examples.git
synced 2024-11-22 16:23:54 +00:00
commit
3e85bb4b22
@ -1,12 +1,14 @@
|
||||
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.onContentMessage
|
||||
import dev.inmo.tgbotapi.extensions.utils.formatting.*
|
||||
import dev.inmo.tgbotapi.extensions.utils.formatting.makeLink
|
||||
import dev.inmo.tgbotapi.types.chat.CommonBot
|
||||
import dev.inmo.tgbotapi.types.chat.CommonUser
|
||||
import dev.inmo.tgbotapi.types.chat.ExtendedBot
|
||||
import dev.inmo.tgbotapi.types.message.*
|
||||
import dev.inmo.tgbotapi.utils.buildEntities
|
||||
import dev.inmo.tgbotapi.utils.code
|
||||
import dev.inmo.tgbotapi.utils.link
|
||||
import dev.inmo.tgbotapi.utils.regular
|
||||
import kotlinx.coroutines.*
|
||||
|
||||
@ -40,7 +42,14 @@ suspend fun main(vararg args: String) {
|
||||
is ExtendedBot -> regular("Bot ")
|
||||
} + code(user.id.chatId.toString()) + " (${user.firstName} ${user.lastName}: ${user.username?.username ?: "Without username"})"
|
||||
}
|
||||
is ForwardInfo.PublicChat.FromChannel -> regular("Channel (") + code(forwardInfo.channelChat.title) + ")"
|
||||
is ForwardInfo.PublicChat.FromChannel -> {
|
||||
regular("Channel (") + (forwardInfo.channelChat.username ?.let {
|
||||
link(
|
||||
forwardInfo.channelChat.title,
|
||||
makeLink(it)
|
||||
)
|
||||
} ?: code(forwardInfo.channelChat.title)) + ")"
|
||||
}
|
||||
is ForwardInfo.PublicChat.FromSupergroup -> regular("Supergroup (") + code(forwardInfo.group.title) + ")"
|
||||
is ForwardInfo.PublicChat.SentByChannel -> regular("Sent by channel (") + code(forwardInfo.channelChat.title) + ")"
|
||||
}
|
||||
|
@ -109,7 +109,11 @@ suspend fun main(args: Array<String>) {
|
||||
}
|
||||
}
|
||||
|
||||
bot.buildBehaviourWithLongPolling {
|
||||
bot.buildBehaviourWithLongPolling(
|
||||
defaultExceptionsHandler = {
|
||||
println(it)
|
||||
}
|
||||
) {
|
||||
onCommand("simple", initialFilter = { it.chat is PublicChat && it.fromUserMessageOrNull() ?.user ?.id == allowedAdmin }) {
|
||||
val replyMessage = it.replyTo
|
||||
val userInReply = replyMessage ?.fromUserMessageOrNull() ?.user ?.id ?: return@onCommand
|
||||
|
@ -1,11 +1,11 @@
|
||||
kotlin.code.style=official
|
||||
org.gradle.parallel=true
|
||||
# Due to parallel compilation project require next amount of memory on full build
|
||||
org.gradle.jvmargs=-Xmx768m
|
||||
org.gradle.jvmargs=-Xmx1g
|
||||
|
||||
|
||||
kotlin_version=1.7.22
|
||||
telegram_bot_api_version=5.2.1
|
||||
micro_utils_version=0.16.10
|
||||
serialization_version=1.4.1
|
||||
kotlin_version=1.8.10
|
||||
telegram_bot_api_version=6.0.0
|
||||
micro_utils_version=0.17.0
|
||||
serialization_version=1.5.0
|
||||
ktor_version=2.2.3
|
||||
|
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.1-bin.zip
|
||||
|
Loading…
Reference in New Issue
Block a user