mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI-examples.git
synced 2024-12-22 08:37:18 +00:00
fixes in samples and update up to 10.0.0
This commit is contained in:
parent
fda366d820
commit
6f3766dff6
@ -42,7 +42,7 @@ suspend fun main(vararg args: String) {
|
||||
val replyResult = reply(
|
||||
it.chat.id,
|
||||
it.messageId,
|
||||
replyInChat = it.reactedUser.id
|
||||
replyInChatId = it.reactedUser.id
|
||||
) {
|
||||
regular("Current reactions for message in reply:\n")
|
||||
it.new.forEach {
|
||||
|
@ -24,6 +24,7 @@ import dev.inmo.tgbotapi.types.chat.ChatPermissions
|
||||
import dev.inmo.tgbotapi.types.chat.PublicChat
|
||||
import dev.inmo.tgbotapi.types.chat.member.*
|
||||
import dev.inmo.tgbotapi.types.commands.BotCommandScope
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.AccessibleMessage
|
||||
import dev.inmo.tgbotapi.types.request.RequestId
|
||||
import dev.inmo.tgbotapi.utils.*
|
||||
import dev.inmo.tgbotapi.utils.mention
|
||||
@ -185,14 +186,21 @@ suspend fun main(args: Array<String>) {
|
||||
) {
|
||||
onCommand(
|
||||
"simple",
|
||||
initialFilter = { it.chat is PublicChat && it.fromUserMessageOrNull()?.user?.id == allowedAdmin }) {
|
||||
initialFilter = { it.chat is PublicChat && it.fromUserMessageOrNull()?.user?.id == allowedAdmin }
|
||||
) {
|
||||
val replyMessage = it.replyTo
|
||||
val userInReply = replyMessage?.fromUserMessageOrNull()?.user?.id ?: return@onCommand
|
||||
if (replyMessage is AccessibleMessage) {
|
||||
reply(
|
||||
replyMessage,
|
||||
"Manage keyboard:",
|
||||
replyMarkup = buildCommonKeyboard(it.chat.id.toChatId(), userInReply) ?: return@onCommand
|
||||
)
|
||||
} else {
|
||||
reply(it) {
|
||||
regular("Reply to somebody's message to get hist/her rights keyboard")
|
||||
}
|
||||
}
|
||||
}
|
||||
onCommand(
|
||||
"granular",
|
||||
@ -204,11 +212,17 @@ suspend fun main(args: Array<String>) {
|
||||
val usernameInText = it.content.textSources.firstNotNullOfOrNull { it.mentionTextSourceOrNull() } ?.username
|
||||
val userInReply = replyMessage?.fromUserMessageOrNull()?.user?.id ?: return@onCommand
|
||||
|
||||
if (replyMessage is AccessibleMessage) {
|
||||
reply(
|
||||
replyMessage,
|
||||
"Manage keyboard:",
|
||||
replyMarkup = buildGranularKeyboard(it.chat.id.toChatId(), userInReply) ?: return@onCommand
|
||||
)
|
||||
} else {
|
||||
reply(it) {
|
||||
regular("Reply to somebody's message to get hist/her rights keyboard")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
onMessageDataCallbackQuery(
|
||||
|
@ -5,7 +5,7 @@ org.gradle.jvmargs=-Xmx2344m
|
||||
|
||||
|
||||
kotlin_version=1.9.22
|
||||
telegram_bot_api_version=10.0.0-branch_10.0.0-build2051
|
||||
micro_utils_version=0.20.25
|
||||
telegram_bot_api_version=10.0.0
|
||||
micro_utils_version=0.20.26
|
||||
serialization_version=1.6.2
|
||||
ktor_version=2.3.7
|
||||
|
Loading…
Reference in New Issue
Block a user