diff --git a/ReactionsInfoBot/src/main/kotlin/ReactionsInfoBot.kt b/ReactionsInfoBot/src/main/kotlin/ReactionsInfoBot.kt index 78d93f6..7bfe094 100644 --- a/ReactionsInfoBot/src/main/kotlin/ReactionsInfoBot.kt +++ b/ReactionsInfoBot/src/main/kotlin/ReactionsInfoBot.kt @@ -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 { diff --git a/RightsChangerBot/src/main/kotlin/RightsChanger.kt b/RightsChangerBot/src/main/kotlin/RightsChanger.kt index 5245696..a2be7ef 100644 --- a/RightsChangerBot/src/main/kotlin/RightsChanger.kt +++ b/RightsChangerBot/src/main/kotlin/RightsChanger.kt @@ -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) { ) { 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 - reply( - replyMessage, - "Manage keyboard:", - replyMarkup = buildCommonKeyboard(it.chat.id.toChatId(), userInReply) ?: 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) { val usernameInText = it.content.textSources.firstNotNullOfOrNull { it.mentionTextSourceOrNull() } ?.username val userInReply = replyMessage?.fromUserMessageOrNull()?.user?.id ?: return@onCommand - reply( - replyMessage, - "Manage keyboard:", - replyMarkup = buildGranularKeyboard(it.chat.id.toChatId(), userInReply) ?: 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( diff --git a/gradle.properties b/gradle.properties index 530c2ba..7b481be 100644 --- a/gradle.properties +++ b/gradle.properties @@ -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