diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index ae04661..070cb70 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/welcome/src/main/kotlin/db/WelcomeTable.kt b/welcome/src/main/kotlin/db/WelcomeTable.kt index 62a3de1..8fd67d3 100644 --- a/welcome/src/main/kotlin/db/WelcomeTable.kt +++ b/welcome/src/main/kotlin/db/WelcomeTable.kt @@ -3,8 +3,10 @@ package db import dev.inmo.micro_utils.repos.exposed.ExposedRepo import dev.inmo.micro_utils.repos.exposed.initTable import dev.inmo.tgbotapi.types.ChatId +import dev.inmo.tgbotapi.types.IdChatIdentifier import model.ChatSettings import org.jetbrains.exposed.sql.* +import org.jetbrains.exposed.sql.SqlExpressionBuilder.eq import org.jetbrains.exposed.sql.transactions.transaction internal class WelcomeTable( @@ -19,7 +21,7 @@ internal class WelcomeTable( initTable() } - fun get(chatId: ChatId): ChatSettings? = transaction(database) { + fun get(chatId: IdChatIdentifier): ChatSettings? = transaction(database) { select { targetChatIdColumn.eq(chatId.chatId) }.limit(1).firstOrNull() ?.let { ChatSettings( ChatId(it[targetChatIdColumn]), @@ -38,7 +40,7 @@ internal class WelcomeTable( }.insertedCount > 0 } - fun unset(chatId: ChatId): Boolean = transaction(database) { + fun unset(chatId: IdChatIdentifier): Boolean = transaction(database) { deleteWhere { targetChatIdColumn.eq(chatId.chatId) } > 0 } } diff --git a/welcome/src/main/kotlin/model/ChatSettings.kt b/welcome/src/main/kotlin/model/ChatSettings.kt index 17e668f..b5ba713 100644 --- a/welcome/src/main/kotlin/model/ChatSettings.kt +++ b/welcome/src/main/kotlin/model/ChatSettings.kt @@ -1,12 +1,13 @@ package model import dev.inmo.tgbotapi.types.ChatId +import dev.inmo.tgbotapi.types.IdChatIdentifier import dev.inmo.tgbotapi.types.MessageIdentifier import kotlinx.serialization.Serializable @Serializable internal data class ChatSettings( - val targetChatId: ChatId, - val sourceChatId: ChatId, + val targetChatId: IdChatIdentifier, + val sourceChatId: IdChatIdentifier, val sourceMessageId: MessageIdentifier )