mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI-examples.git
synced 2024-12-22 16:47: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(
|
val replyResult = reply(
|
||||||
it.chat.id,
|
it.chat.id,
|
||||||
it.messageId,
|
it.messageId,
|
||||||
replyInChat = it.reactedUser.id
|
replyInChatId = it.reactedUser.id
|
||||||
) {
|
) {
|
||||||
regular("Current reactions for message in reply:\n")
|
regular("Current reactions for message in reply:\n")
|
||||||
it.new.forEach {
|
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.PublicChat
|
||||||
import dev.inmo.tgbotapi.types.chat.member.*
|
import dev.inmo.tgbotapi.types.chat.member.*
|
||||||
import dev.inmo.tgbotapi.types.commands.BotCommandScope
|
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.types.request.RequestId
|
||||||
import dev.inmo.tgbotapi.utils.*
|
import dev.inmo.tgbotapi.utils.*
|
||||||
import dev.inmo.tgbotapi.utils.mention
|
import dev.inmo.tgbotapi.utils.mention
|
||||||
@ -185,14 +186,21 @@ suspend fun main(args: Array<String>) {
|
|||||||
) {
|
) {
|
||||||
onCommand(
|
onCommand(
|
||||||
"simple",
|
"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 replyMessage = it.replyTo
|
||||||
val userInReply = replyMessage?.fromUserMessageOrNull()?.user?.id ?: return@onCommand
|
val userInReply = replyMessage?.fromUserMessageOrNull()?.user?.id ?: return@onCommand
|
||||||
reply(
|
if (replyMessage is AccessibleMessage) {
|
||||||
replyMessage,
|
reply(
|
||||||
"Manage keyboard:",
|
replyMessage,
|
||||||
replyMarkup = buildCommonKeyboard(it.chat.id.toChatId(), userInReply) ?: return@onCommand
|
"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(
|
onCommand(
|
||||||
"granular",
|
"granular",
|
||||||
@ -204,11 +212,17 @@ suspend fun main(args: Array<String>) {
|
|||||||
val usernameInText = it.content.textSources.firstNotNullOfOrNull { it.mentionTextSourceOrNull() } ?.username
|
val usernameInText = it.content.textSources.firstNotNullOfOrNull { it.mentionTextSourceOrNull() } ?.username
|
||||||
val userInReply = replyMessage?.fromUserMessageOrNull()?.user?.id ?: return@onCommand
|
val userInReply = replyMessage?.fromUserMessageOrNull()?.user?.id ?: return@onCommand
|
||||||
|
|
||||||
reply(
|
if (replyMessage is AccessibleMessage) {
|
||||||
replyMessage,
|
reply(
|
||||||
"Manage keyboard:",
|
replyMessage,
|
||||||
replyMarkup = buildGranularKeyboard(it.chat.id.toChatId(), userInReply) ?: return@onCommand
|
"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(
|
onMessageDataCallbackQuery(
|
||||||
|
@ -5,7 +5,7 @@ org.gradle.jvmargs=-Xmx2344m
|
|||||||
|
|
||||||
|
|
||||||
kotlin_version=1.9.22
|
kotlin_version=1.9.22
|
||||||
telegram_bot_api_version=10.0.0-branch_10.0.0-build2051
|
telegram_bot_api_version=10.0.0
|
||||||
micro_utils_version=0.20.25
|
micro_utils_version=0.20.26
|
||||||
serialization_version=1.6.2
|
serialization_version=1.6.2
|
||||||
ktor_version=2.3.7
|
ktor_version=2.3.7
|
||||||
|
Loading…
Reference in New Issue
Block a user