From 8cc2503934231ada61d512d7b30feeafc10337c9 Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Sun, 28 Mar 2021 15:31:54 +0600 Subject: [PATCH] small update --- .../plagubot/plugins/captcha/provider/CaptchaProvider.kt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/kotlin/dev/inmo/plagubot/plugins/captcha/provider/CaptchaProvider.kt b/src/main/kotlin/dev/inmo/plagubot/plugins/captcha/provider/CaptchaProvider.kt index 250c27a..d40b5ec 100644 --- a/src/main/kotlin/dev/inmo/plagubot/plugins/captcha/provider/CaptchaProvider.kt +++ b/src/main/kotlin/dev/inmo/plagubot/plugins/captcha/provider/CaptchaProvider.kt @@ -165,7 +165,7 @@ data class SimpleCaptchaProvider( } } - val job = launch { + val job = parallel { waitDataCallbackQuery { if (it.id == user.id && this.data == callbackData) { this @@ -179,15 +179,15 @@ data class SimpleCaptchaProvider( stop() } - launch { - delay((userBanDateTime - eventDateTime).millisecondsLong) + delay((userBanDateTime - eventDateTime).millisecondsLong) + if (job.isActive) { job.cancel() if (kick) { safelyWithoutExceptions { kickChatMember(chat, it) } } - stop() } + stop() } } }