mirror of
https://github.com/InsanusMokrassar/TelegramBotTutorial.git
synced 2024-12-22 06:07:11 +00:00
update fixes
This commit is contained in:
parent
7ae5a158bb
commit
5646b2f581
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
@ -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
|
||||
|
@ -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
|
||||
}
|
||||
}
|
||||
|
@ -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
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user