Spaces:
Running
Running
Update chatbot/plugins/join_request.py
Browse files- chatbot/plugins/join_request.py +33 -31
chatbot/plugins/join_request.py
CHANGED
@@ -358,38 +358,40 @@ async def verify_captcha_callback(client: Client, cb: CallbackQuery):
|
|
358 |
captcha_text, correct_answer = captcha_texts.get(user_id)
|
359 |
failed_image = failed_hacker_by_randydev()
|
360 |
hacker_image = thanks_hacker_by_randydev()
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
-
|
365 |
-
|
366 |
-
|
367 |
-
|
368 |
-
|
369 |
-
logger.info(f"User {user_id} berhasil memverifikasi CAPTCHA.")
|
370 |
-
await client.approve_chat_join_request(
|
371 |
-
chat_id=captcha_texts.get("chat_id"),
|
372 |
-
user_id=user_id
|
373 |
-
)
|
374 |
-
del captcha_texts[user_id]
|
375 |
-
del captcha_texts["chat_id"]
|
376 |
-
del captcha_texts["chat_link"]
|
377 |
-
else:
|
378 |
-
await cb.edit_message_media(
|
379 |
-
media=InputMediaPhoto(
|
380 |
-
failed_image,
|
381 |
-
caption="❌ **CAPTCHA verification failed.**\n\nPlease try again."
|
382 |
)
|
383 |
-
|
384 |
-
|
385 |
-
|
386 |
-
|
387 |
-
|
388 |
-
|
389 |
-
|
390 |
-
|
391 |
-
|
392 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
393 |
|
394 |
@Client.on_callback_query(filters.regex("^cancel_mode$"))
|
395 |
async def cancel_mode_callback(client: Client, cb: CallbackQuery):
|
|
|
358 |
captcha_text, correct_answer = captcha_texts.get(user_id)
|
359 |
failed_image = failed_hacker_by_randydev()
|
360 |
hacker_image = thanks_hacker_by_randydev()
|
361 |
+
try:
|
362 |
+
if str(user_choice) == str(correct_answer):
|
363 |
+
await cb.edit_message_media(
|
364 |
+
media=InputMediaPhoto(
|
365 |
+
hacker_image,
|
366 |
+
caption="✅ CAPTCHA verification successful!"
|
367 |
+
),
|
368 |
+
reply_markup=create_button_join_group(captcha_texts.get("chat_link"))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
369 |
)
|
370 |
+
logger.info(f"User {user_id} berhasil memverifikasi CAPTCHA.")
|
371 |
+
await client.approve_chat_join_request(
|
372 |
+
chat_id=captcha_texts.get("chat_id"),
|
373 |
+
user_id=user_id
|
374 |
+
)
|
375 |
+
del captcha_texts[user_id]
|
376 |
+
del captcha_texts["chat_id"]
|
377 |
+
del captcha_texts["chat_link"]
|
378 |
+
else:
|
379 |
+
await cb.edit_message_media(
|
380 |
+
media=InputMediaPhoto(
|
381 |
+
failed_image,
|
382 |
+
caption="❌ **CAPTCHA verification failed.**\n\nPlease try again."
|
383 |
+
)
|
384 |
+
)
|
385 |
+
await client.decline_chat_join_request(
|
386 |
+
chat_id=captcha_texts.get("chat_id"),
|
387 |
+
user_id=user_id
|
388 |
+
)
|
389 |
+
logger.info(f"User {user_id} gagal memverifikasi CAPTCHA.")
|
390 |
+
del captcha_texts[user_id]
|
391 |
+
del captcha_texts["chat_id"]
|
392 |
+
del captcha_texts["chat_link"]
|
393 |
+
except Exception as e:
|
394 |
+
await cb.answer(f"Error CAPTCHA: {e}")
|
395 |
|
396 |
@Client.on_callback_query(filters.regex("^cancel_mode$"))
|
397 |
async def cancel_mode_callback(client: Client, cb: CallbackQuery):
|