From 33b2b4fbcb88cc88509c4318711587ed6a0aa291 Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Mon, 11 Jul 2022 13:07:42 +0600 Subject: [PATCH] refactor after dependencies update --- welcome/src/main/kotlin/WelcomePlugin.kt | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/welcome/src/main/kotlin/WelcomePlugin.kt b/welcome/src/main/kotlin/WelcomePlugin.kt index a3a36c3..40a45f6 100644 --- a/welcome/src/main/kotlin/WelcomePlugin.kt +++ b/welcome/src/main/kotlin/WelcomePlugin.kt @@ -15,6 +15,8 @@ import dev.inmo.tgbotapi.extensions.behaviour_builder.expectations.waitContentMe import dev.inmo.tgbotapi.extensions.behaviour_builder.expectations.waitMessageDataCallbackQuery import dev.inmo.tgbotapi.extensions.behaviour_builder.triggers_handling.* import dev.inmo.tgbotapi.extensions.utils.* +import dev.inmo.tgbotapi.extensions.utils.extensions.sameChat +import dev.inmo.tgbotapi.extensions.utils.extensions.sameMessage import dev.inmo.tgbotapi.extensions.utils.formatting.* import dev.inmo.tgbotapi.extensions.utils.types.buttons.* import dev.inmo.tgbotapi.types.BotCommand @@ -83,20 +85,16 @@ class WelcomePlugin : Plugin { regular("Ok, send me the message which should be used as welcome message for chat ") underline(groupMessage.chat.title) }, - replyMarkup = inlineKeyboard { - row { - dataButton("Unset", unsetData) - dataButton("Cancel", cancelData) - } + replyMarkup = flatInlineKeyboard { + dataButton("Unset", unsetData) + dataButton("Cancel", cancelData) } ) oneOf( parallel { val query = waitMessageDataCallbackQuery().filter { - it.data == unsetData - && it.message.chat.id == sentMessage.chat.id - && it.message.messageId == sentMessage.messageId + it.data == unsetData && it.message.sameMessage(sentMessage) }.first() val answerEntities = buildEntities { @@ -118,9 +116,7 @@ class WelcomePlugin : Plugin { }, parallel { val query = waitMessageDataCallbackQuery().filter { - it.data == cancelData - && it.message.chat.id == sentMessage.chat.id - && it.message.messageId == sentMessage.messageId + it.data == cancelData && it.message.sameMessage(sentMessage) }.first() edit( @@ -135,7 +131,7 @@ class WelcomePlugin : Plugin { }, parallel { val message = waitContentMessage().filter { - it.chat.id == sentMessage.chat.id + it.sameChat(sentMessage) }.first() val success = welcomeTable.set(