mirror of
https://github.com/InsanusMokrassar/CaptchaPlaguBotPlugin.git
synced 2024-11-25 11:38:55 +00:00
fix in db
This commit is contained in:
parent
506f319c88
commit
f84edb7860
@ -2,6 +2,7 @@ package dev.inmo.plagubot.plugins.captcha.db
|
|||||||
|
|
||||||
import dev.inmo.micro_utils.repos.exposed.*
|
import dev.inmo.micro_utils.repos.exposed.*
|
||||||
import dev.inmo.plagubot.plugins.captcha.provider.CaptchaProvider
|
import dev.inmo.plagubot.plugins.captcha.provider.CaptchaProvider
|
||||||
|
import dev.inmo.plagubot.plugins.captcha.provider.SimpleCaptchaProvider
|
||||||
import dev.inmo.plagubot.plugins.captcha.settings.*
|
import dev.inmo.plagubot.plugins.captcha.settings.*
|
||||||
import dev.inmo.tgbotapi.types.ChatId
|
import dev.inmo.tgbotapi.types.ChatId
|
||||||
import dev.inmo.tgbotapi.types.toChatId
|
import dev.inmo.tgbotapi.types.toChatId
|
||||||
@ -14,13 +15,17 @@ private val captchaProviderSerialFormat = Json {
|
|||||||
ignoreUnknownKeys = true
|
ignoreUnknownKeys = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private val defaultCaptchaProviderValue = captchaProviderSerialFormat.encodeToString(CaptchaProvider.serializer(), SimpleCaptchaProvider())
|
||||||
|
|
||||||
class CaptchaChatsSettingsRepo(
|
class CaptchaChatsSettingsRepo(
|
||||||
override val database: Database
|
override val database: Database
|
||||||
) : AbstractExposedCRUDRepo<ChatSettings, ChatId, ChatSettings>(
|
) : AbstractExposedCRUDRepo<ChatSettings, ChatId, ChatSettings>(
|
||||||
tableName = "CaptchaChatsSettingsRepo"
|
tableName = "CaptchaChatsSettingsRepo"
|
||||||
) {
|
) {
|
||||||
private val chatIdColumn = long("chatId")
|
private val chatIdColumn = long("chatId")
|
||||||
private val captchaProviderColumn = text("captchaProvider")
|
private val captchaProviderColumn = text("captchaProvider").apply {
|
||||||
|
default(defaultCaptchaProviderValue)
|
||||||
|
}
|
||||||
private val autoRemoveCommandsColumn = bool("autoRemoveCommands")
|
private val autoRemoveCommandsColumn = bool("autoRemoveCommands")
|
||||||
|
|
||||||
override val primaryKey = PrimaryKey(chatIdColumn)
|
override val primaryKey = PrimaryKey(chatIdColumn)
|
||||||
|
Loading…
Reference in New Issue
Block a user