From ecbc0829f02029ac2ea32138f8740992bae91e1a Mon Sep 17 00:00:00 2001 From: djaler Date: Wed, 5 Jul 2023 23:08:58 +0300 Subject: [PATCH] =?UTF-8?q?deps:=20=D0=BF=D0=BE=D0=B4=D0=BD=D1=8F=D1=82?= =?UTF-8?q?=D0=B0=20=D0=B2=D0=B5=D1=80=D1=81=D0=B8=D1=8F=20tgbotapi=20?= =?UTF-8?q?=D0=B4=D0=BE=209.00=20=D0=B8=20ktor=20=D0=B4=D0=BE=202.3.2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build.gradle.kts | 10 +++++----- .../evilbot/filters/message/CommandMessageFilter.kt | 5 +++-- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index 27d9ddb6..6390beb4 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -37,12 +37,12 @@ dependencies { implementation("org.postgresql:postgresql") implementation("org.flywaydb:flyway-core") - implementation("dev.inmo:tgbotapi:5.2.1") + implementation("dev.inmo:tgbotapi:9.0.0") - implementation("io.ktor:ktor-server-netty:2.1.3") - implementation("io.ktor:ktor-client-apache:2.1.3") - implementation("io.ktor:ktor-client-content-negotiation:2.1.3") - implementation("io.ktor:ktor-serialization-jackson:2.1.3") + implementation("io.ktor:ktor-server-netty:2.3.2") + implementation("io.ktor:ktor-client-apache:2.3.2") + implementation("io.ktor:ktor-client-content-negotiation:2.3.2") + implementation("io.ktor:ktor-serialization-jackson:2.3.2") implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4") diff --git a/src/main/kotlin/com/github/djaler/evilbot/filters/message/CommandMessageFilter.kt b/src/main/kotlin/com/github/djaler/evilbot/filters/message/CommandMessageFilter.kt index 87ecd3b3..a5241313 100644 --- a/src/main/kotlin/com/github/djaler/evilbot/filters/message/CommandMessageFilter.kt +++ b/src/main/kotlin/com/github/djaler/evilbot/filters/message/CommandMessageFilter.kt @@ -10,7 +10,7 @@ class CommandMessageFilter( private val command: Array, botInfo: ExtendedBot ) : MessageFilter { - private val botUsername = botInfo.username.username + private val botUsername = botInfo.username override suspend fun filter(message: Message): Boolean { if (message !is CommonMessage<*>) { @@ -26,7 +26,8 @@ class CommandMessageFilter( if (command[0].lowercase() !in this.command) { return false } - if (command.size > 1 && "@${command[1].lowercase()}" != botUsername.lowercase()) { + if (command.size > 1 && botUsername != null + && command[1].lowercase() != botUsername.usernameWithoutAt.lowercase()) { return false }