mirror of
https://github.com/InsanusMokrassar/CaptchaPlaguBotPlugin.git
synced 2024-11-25 03:28:52 +00:00
removing deprecations
This commit is contained in:
parent
8017678da8
commit
e375170567
@ -18,15 +18,13 @@ import dev.inmo.tgbotapi.extensions.utils.extensions.parseCommandsWithParams
|
||||
import dev.inmo.tgbotapi.extensions.utils.extensions.sourceChat
|
||||
import dev.inmo.tgbotapi.libraries.cache.admins.*
|
||||
import dev.inmo.tgbotapi.types.BotCommand
|
||||
import dev.inmo.tgbotapi.types.chat.RestrictionsChatPermissions
|
||||
import dev.inmo.tgbotapi.types.chat.abstracts.extended.ExtendedGroupChat
|
||||
import dev.inmo.tgbotapi.types.chat.*
|
||||
import kotlinx.coroutines.*
|
||||
import kotlinx.serialization.Serializable
|
||||
import kotlinx.serialization.json.JsonObject
|
||||
import org.jetbrains.exposed.sql.Database
|
||||
import org.koin.core.Koin
|
||||
import org.koin.core.module.Module
|
||||
import dev.inmo.tgbotapi.types.chat.Chat
|
||||
|
||||
private const val enableAutoDeleteCommands = "captcha_auto_delete_commands_on"
|
||||
private const val disableAutoDeleteCommands = "captcha_auto_delete_commands_off"
|
||||
@ -132,7 +130,7 @@ class CaptchaBotPlugin : Plugin {
|
||||
}
|
||||
val defaultChatPermissions = (getChat(it.chat) as ExtendedGroupChat).permissions
|
||||
|
||||
doInSubContext(stopOnCompletion = false) {
|
||||
createSubContextAndDoWithUpdatesFilter(stopOnCompletion = false) {
|
||||
launch {
|
||||
settings.captchaProvider.apply { doAction(it.date, chat, newUsers, defaultChatPermissions) }
|
||||
}
|
||||
|
@ -21,13 +21,13 @@ import dev.inmo.tgbotapi.extensions.utils.shortcuts.executeUnsafe
|
||||
import dev.inmo.tgbotapi.extensions.utils.types.buttons.InlineKeyboardMarkup
|
||||
import dev.inmo.tgbotapi.requests.DeleteMessage
|
||||
import dev.inmo.tgbotapi.types.*
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.textsources.mention
|
||||
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardButtons.CallbackDataInlineKeyboardButton
|
||||
import dev.inmo.tgbotapi.types.chat.ChatPermissions
|
||||
import dev.inmo.tgbotapi.types.chat.LeftRestrictionsChatPermissions
|
||||
import dev.inmo.tgbotapi.types.chat.abstracts.*
|
||||
import dev.inmo.tgbotapi.types.chat.*
|
||||
import dev.inmo.tgbotapi.types.chat.User
|
||||
import dev.inmo.tgbotapi.types.dice.SlotMachineDiceAnimationType
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.Message
|
||||
import dev.inmo.tgbotapi.types.message.textsources.mention
|
||||
import kotlinx.coroutines.*
|
||||
import kotlinx.coroutines.channels.Channel
|
||||
import kotlinx.coroutines.channels.toList
|
||||
@ -94,12 +94,12 @@ data class SlotMachineCaptchaProvider(
|
||||
val authorized = Channel<User>(newUsers.size)
|
||||
val messagesToDelete = Channel<Message>(Channel.UNLIMITED)
|
||||
val subContexts = newUsers.map {
|
||||
doInSubContext(stopOnCompletion = false) {
|
||||
createSubContextAndDoWithUpdatesFilter (stopOnCompletion = false) {
|
||||
val sentMessage = sendTextMessage(
|
||||
chat,
|
||||
buildEntities {
|
||||
+it.mention(it.firstName)
|
||||
regular(", ${captchaText}")
|
||||
regular(", $captchaText")
|
||||
}
|
||||
).also { messagesToDelete.send(it) }
|
||||
val sentDice = sendDice(
|
||||
@ -182,7 +182,7 @@ data class SimpleCaptchaProvider(
|
||||
newUsers.mapNotNull {
|
||||
safelyWithoutExceptions {
|
||||
launch {
|
||||
doInSubContext(stopOnCompletion = false) {
|
||||
createSubContextAndDoWithUpdatesFilter(stopOnCompletion = false) {
|
||||
val callbackData = uuid4().toString()
|
||||
val sentMessage = sendTextMessage(
|
||||
chat,
|
||||
@ -294,7 +294,7 @@ data class ExpressionCaptchaProvider(
|
||||
val userBanDateTime = eventDateTime + checkTimeSpan
|
||||
newUsers.map { user ->
|
||||
launch {
|
||||
doInSubContext {
|
||||
createSubContextAndDoWithUpdatesFilter {
|
||||
val callbackData = ExpressionBuilder.createExpression(
|
||||
maxPerNumber,
|
||||
operations
|
||||
|
Loading…
Reference in New Issue
Block a user