randydev commited on
Commit
87491a8
·
verified ·
1 Parent(s): 2807d9f

Update chatbot/plugins/join_request.py

Browse files
Files changed (1) hide show
  1. chatbot/plugins/join_request.py +13 -9
chatbot/plugins/join_request.py CHANGED
@@ -242,10 +242,11 @@ async def join_request(client: Client, event: ChatJoinRequest):
242
  mode = captcha_modes.get(event.from_user.id, "text")
243
  captcha_text, img_path, choices, correct_answer = generate_captcha(event.from_user.id, mode)
244
  captcha_texts[event.from_user.id] = {
245
- 'captcha_text': captcha_text,
246
- 'correct_answer': correct_answer,
247
- 'chat_id': event.chat.id,
248
- 'chat_link': chat_link
 
249
  }
250
 
251
  buttons = [
@@ -301,10 +302,11 @@ async def verify_captcha_callback(client: Client, cb: CallbackQuery):
301
  logger.warning(f"User {user_id} mencoba memverifikasi CAPTCHA tanpa aktif.")
302
  return
303
  captcha_data = captcha_texts.get(user_id)
304
- captcha_text = captcha_data['captcha_text']
305
- correct_answer = captcha_data['correct_answer']
306
- chat_id = captcha_data['chat_id']
307
- chat_link = captcha_data['chat_link']
 
308
 
309
  failed_image = failed_hacker_by_randydev()
310
  hacker_image = thanks_hacker_by_randydev()
@@ -323,6 +325,7 @@ async def verify_captcha_callback(client: Client, cb: CallbackQuery):
323
  chat_id=chat_id,
324
  user_id=user_id
325
  )
 
326
  del captcha_texts[user_id]
327
  else:
328
  await cb.edit_message_media(
@@ -335,6 +338,7 @@ async def verify_captcha_callback(client: Client, cb: CallbackQuery):
335
  chat_id=chat_id,
336
  user_id=user_id
337
  )
 
338
  logger.info(f"User {user_id} gagal memverifikasi CAPTCHA.")
339
  del captcha_texts[user_id]
340
  except Exception as e:
@@ -406,7 +410,7 @@ def create_button_join_group(chat_link):
406
  def create_button_userinfo(user_id, username):
407
  return InlineKeyboardMarkup(
408
  [
409
- [InlineKeyboardButton("👤 Chmod +W $USER", url=f"tg://user?id={user_id}")],
410
  [InlineKeyboardButton("🔔 Check human Bot", url=f"https://t.me/{username}")],
411
  ]
412
  )
 
242
  mode = captcha_modes.get(event.from_user.id, "text")
243
  captcha_text, img_path, choices, correct_answer = generate_captcha(event.from_user.id, mode)
244
  captcha_texts[event.from_user.id] = {
245
+ "captcha_text": captcha_text,
246
+ "correct_answer": correct_answer,
247
+ "chat_id": event.chat.id,
248
+ "chat_link": chat_link,
249
+ "first_name": event.from_user.first_name
250
  }
251
 
252
  buttons = [
 
302
  logger.warning(f"User {user_id} mencoba memverifikasi CAPTCHA tanpa aktif.")
303
  return
304
  captcha_data = captcha_texts.get(user_id)
305
+ captcha_text = captcha_data["captcha_text"]
306
+ correct_answer = captcha_data["correct_answer"]
307
+ chat_id = captcha_data["chat_id"]
308
+ chat_link = captcha_data["chat_link"]
309
+ first_name = captcha_data["first_name"]
310
 
311
  failed_image = failed_hacker_by_randydev()
312
  hacker_image = thanks_hacker_by_randydev()
 
325
  chat_id=chat_id,
326
  user_id=user_id
327
  )
328
+ await client.send_message(chat_id, f"Thank you for joining {first_name}")
329
  del captcha_texts[user_id]
330
  else:
331
  await cb.edit_message_media(
 
338
  chat_id=chat_id,
339
  user_id=user_id
340
  )
341
+ await client.send_message(chat_id, f"Failed to join {first_name}")
342
  logger.info(f"User {user_id} gagal memverifikasi CAPTCHA.")
343
  del captcha_texts[user_id]
344
  except Exception as e:
 
410
  def create_button_userinfo(user_id, username):
411
  return InlineKeyboardMarkup(
412
  [
413
+ [InlineKeyboardButton("👤 Chmod +W $USER", user_id=user_id)],
414
  [InlineKeyboardButton("🔔 Check human Bot", url=f"https://t.me/{username}")],
415
  ]
416
  )