diff --git a/bin/install.sh b/bin/install.sh index c91b65f..ad14b28 100755 --- a/bin/install.sh +++ b/bin/install.sh @@ -56,6 +56,7 @@ function check_redis { if command -v apt-get &>/dev/null; then sudo apt-get update sudo apt-get install -y software-properties-common + sudo add-apt-repository ppa:redislabs/redis sudo apt-get update sudo apt-get install -y redis check_redis diff --git a/build.gradle.kts b/build.gradle.kts index 2981cd9..1d8a86c 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,5 +1,5 @@ plugins { - kotlin("jvm") version "1.8.21" + kotlin("jvm") version "1.8.22" application } @@ -11,14 +11,13 @@ repositories { } dependencies { - implementation("org.jetbrains.kotlin:kotlin-stdlib:1.8.20") + implementation("org.jetbrains.kotlin:kotlin-stdlib:1.8.22") // Logger implementation(group = "io.github.microutils", name = "kotlin-logging-jvm", version = "3.0.5") implementation("org.slf4j:slf4j-simple:2.0.7") // Bot Api - implementation("dev.inmo:tgbotapi-jvm:7.1.2") + implementation("dev.inmo:tgbotapi-jvm:8.1.0") // DB - implementation("com.github.jasync-sql:jasync-mysql:2.1.24") implementation("io.github.crackthecodeabhi:kreds:0.8.1") } diff --git a/src/main/kotlin/db/RedisService.kt b/src/main/kotlin/db/RedisService.kt index 9704e07..43baf65 100644 --- a/src/main/kotlin/db/RedisService.kt +++ b/src/main/kotlin/db/RedisService.kt @@ -6,7 +6,6 @@ import io.github.crackthecodeabhi.kreds.connection.Endpoint import io.github.crackthecodeabhi.kreds.connection.KredsClient import io.github.crackthecodeabhi.kreds.connection.KredsConnectionException import io.github.crackthecodeabhi.kreds.connection.newClient -import io.netty.handler.codec.CodecException import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.launch @@ -27,9 +26,6 @@ object RedisService { } catch (e: KredsConnectionException) { client = null logger.error(ErrorHandler.parseStackTrace(e)) - } catch (e: CodecException) { - client = null - logger.error(ErrorHandler.parseStackTrace(e)) } } diff --git a/src/main/kotlin/env/Environment.kt b/src/main/kotlin/env/Environment.kt index d79819e..bf2b55e 100644 --- a/src/main/kotlin/env/Environment.kt +++ b/src/main/kotlin/env/Environment.kt @@ -11,6 +11,7 @@ import dev.inmo.tgbotapi.types.ChatId import dev.inmo.tgbotapi.types.Username import dev.inmo.tgbotapi.types.chat.ExtendedSupergroupChatImpl import dev.inmo.tgbotapi.types.chat.member.AdministratorChatMemberImpl +import dev.inmo.tgbotapi.utils.RiskFeature import env.LocaleData.getI18nString import io.ktor.client.plugins.* import mu.KotlinLogging @@ -85,6 +86,8 @@ class Environment { return false } } + + @OptIn(RiskFeature::class) suspend fun checkGroupPermission(bot: TelegramBot): Boolean { logger.info("Checking permission...") try { diff --git a/src/main/kotlin/utils/TextUtils.kt b/src/main/kotlin/utils/TextUtils.kt index 4a444d7..25e4e10 100644 --- a/src/main/kotlin/utils/TextUtils.kt +++ b/src/main/kotlin/utils/TextUtils.kt @@ -1,14 +1,12 @@ package utils -import com.github.jasync.sql.db.util.length - object TextUtils { fun isTelegramBlankName(userName: String): Boolean { val chars = userName.toByteArray() if (chars.isEmpty()) { return false } - if (chars.length < 3) return false + if (chars.size < 3) return false return chars[0] == (-29).toByte() && chars[1] == (-123).toByte() && chars[2] == (-92).toByte() } }