From c84cff9ddc2127fc8a47c397400878bffe372e75 Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Wed, 21 Sep 2022 14:51:24 +0600 Subject: [PATCH] fixes in captcha chats settings repo --- .../plugins/captcha/db/CaptchaChatsSettingsRepo.kt | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/main/kotlin/dev/inmo/plagubot/plugins/captcha/db/CaptchaChatsSettingsRepo.kt b/src/main/kotlin/dev/inmo/plagubot/plugins/captcha/db/CaptchaChatsSettingsRepo.kt index 15e4821..aa020ad 100644 --- a/src/main/kotlin/dev/inmo/plagubot/plugins/captcha/db/CaptchaChatsSettingsRepo.kt +++ b/src/main/kotlin/dev/inmo/plagubot/plugins/captcha/db/CaptchaChatsSettingsRepo.kt @@ -33,6 +33,7 @@ class CaptchaChatsSettingsRepo( private val autoRemoveCommandsColumn = bool("autoRemoveCommands") private val autoRemoveEventsColumn = bool("autoRemoveEvents").apply { default(true) } private val enabledColumn = bool("enabled").default(true) + private val kickOnUnsuccessColumn = bool("kick").default(true) override val primaryKey = PrimaryKey(chatIdColumn) @@ -46,6 +47,7 @@ class CaptchaChatsSettingsRepo( it[autoRemoveCommandsColumn] = value.autoRemoveCommands it[autoRemoveEventsColumn] = value.autoRemoveEvents it[enabledColumn] = value.enabled + it[kickOnUnsuccessColumn] = value.kickOnUnsuccess } override fun update(id: ChatId, value: ChatSettings, it: UpdateStatement) { @@ -54,6 +56,7 @@ class CaptchaChatsSettingsRepo( it[autoRemoveCommandsColumn] = value.autoRemoveCommands it[autoRemoveEventsColumn] = value.autoRemoveEvents it[enabledColumn] = value.enabled + it[kickOnUnsuccessColumn] = value.kickOnUnsuccess } } @@ -62,7 +65,8 @@ class CaptchaChatsSettingsRepo( captchaProvider = captchaProviderSerialFormat.decodeFromString(CaptchaProvider.serializer(), get(captchaProviderColumn)), autoRemoveCommands = get(autoRemoveCommandsColumn), autoRemoveEvents = get(autoRemoveEventsColumn), - enabled = get(enabledColumn) + enabled = get(enabledColumn), + kickOnUnsuccess = get(kickOnUnsuccessColumn) ) override val selectById: SqlExpressionBuilder.(ChatId) -> Op = { chatIdColumn.eq(it.chatId) } @@ -72,7 +76,8 @@ class CaptchaChatsSettingsRepo( captchaProvider = captchaProviderSerialFormat.decodeFromString(CaptchaProvider.serializer(), get(captchaProviderColumn)), autoRemoveCommands = get(autoRemoveCommandsColumn), autoRemoveEvents = get(autoRemoveEventsColumn), - enabled = get(enabledColumn) + enabled = get(enabledColumn), + kickOnUnsuccess = get(kickOnUnsuccessColumn) ) init {