mirror of
https://github.com/InsanusMokrassar/CaptchaPlaguBotPlugin.git
synced 2024-11-25 03:28:52 +00:00
fixes
This commit is contained in:
parent
f1093d6944
commit
d8dbb2512f
@ -1,6 +1,7 @@
|
||||
package dev.inmo.plagubot.plugins.captcha
|
||||
|
||||
import dev.inmo.tgbotapi.extensions.utils.SlotMachineReelImage
|
||||
import dev.inmo.tgbotapi.extensions.utils.types.buttons.*
|
||||
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardButtons.CallbackDataInlineKeyboardButton
|
||||
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
||||
|
||||
@ -23,7 +24,10 @@ fun slotMachineReplyMarkup(
|
||||
}
|
||||
else -> listOf(CallbackDataInlineKeyboardButton("$first$second$third", "$first$second$third"))
|
||||
}
|
||||
return InlineKeyboardMarkup(
|
||||
texts.chunked(2)
|
||||
)
|
||||
return inlineKeyboard {
|
||||
texts.chunked(2).forEach { add(it) }
|
||||
// row {
|
||||
// dataButton("Cancel (Admins only)", "cancel")
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
@ -146,7 +146,9 @@ data class SlotMachineCaptchaProvider(
|
||||
val clicked = arrayOf<String?>(null, null, null)
|
||||
while (leftToClick.isNotEmpty()) {
|
||||
val userClicked = waitMessageDataCallbackQuery().filter { it.user.id == user.id && it.message.messageId == sentDice.messageId }.first()
|
||||
if (userClicked.data == leftToClick.first()) {
|
||||
|
||||
when {
|
||||
userClicked.data == leftToClick.first() -> {
|
||||
clicked[3 - leftToClick.size] = leftToClick.removeAt(0)
|
||||
if (clicked.contains(null)) {
|
||||
safelyWithoutExceptions { answerCallbackQuery(userClicked, "Ok, next one") }
|
||||
@ -156,8 +158,8 @@ data class SlotMachineCaptchaProvider(
|
||||
safelyWithoutExceptions { deleteMessage(sentMessage) }
|
||||
safelyWithoutExceptions { deleteMessage(sentDice) }
|
||||
}
|
||||
} else {
|
||||
safelyWithoutExceptions { answerCallbackQuery(userClicked, "Nope") }
|
||||
}
|
||||
else -> safelyWithoutExceptions { answerCallbackQuery(userClicked, "Nope") }
|
||||
}
|
||||
}
|
||||
authorized.send(user)
|
||||
@ -378,12 +380,9 @@ data class ExpressionCaptchaProvider(
|
||||
if (passed == null) {
|
||||
removeRedundantMessages()
|
||||
passed = it
|
||||
if (it) {
|
||||
safelyWithoutExceptions { restrictChatMember(chat, user, permissions = leftRestrictionsPermissions) }
|
||||
} else {
|
||||
if (kickOnUnsuccess) {
|
||||
banUser(chat, user, leftRestrictionsPermissions)
|
||||
}
|
||||
when {
|
||||
it -> safelyWithoutExceptions { restrictChatMember(chat, user, permissions = leftRestrictionsPermissions) }
|
||||
kickOnUnsuccess -> banUser(chat, user, leftRestrictionsPermissions)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user