Skip to content

Commit

Permalink
update dep version;fix some class;fix shell
Browse files Browse the repository at this point in the history
  • Loading branch information
LittleMengBot committed Jun 23, 2023
1 parent 58c4c70 commit 9746547
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 11 deletions.
1 change: 1 addition & 0 deletions bin/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 3 additions & 4 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
kotlin("jvm") version "1.8.21"
kotlin("jvm") version "1.8.22"
application
}

Expand All @@ -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")
}

Expand Down
4 changes: 0 additions & 4 deletions src/main/kotlin/db/RedisService.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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))
}
}

Expand Down
3 changes: 3 additions & 0 deletions src/main/kotlin/env/Environment.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -85,6 +86,8 @@ class Environment {
return false
}
}

@OptIn(RiskFeature::class)
suspend fun checkGroupPermission(bot: TelegramBot): Boolean {
logger.info("Checking permission...")
try {
Expand Down
4 changes: 1 addition & 3 deletions src/main/kotlin/utils/TextUtils.kt
Original file line number Diff line number Diff line change
@@ -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()
}
}

0 comments on commit 9746547

Please sign in to comment.