randydev commited on
Commit
27cf193
·
verified ·
1 Parent(s): 0f1b2a1

Update chatbot/plugins/join_request.py

Browse files
Files changed (1) hide show
  1. chatbot/plugins/join_request.py +12 -2
chatbot/plugins/join_request.py CHANGED
@@ -201,7 +201,17 @@ async def mode_callback(client: Client, cb: CallbackQuery):
201
  await cb.answer("❌ Invalid mode.", show_alert=True)
202
  return
203
  captcha_modes[user_id] = mode
204
- await cb.edit_message_text(f"✅ CAPTCHA mode has been set to **{'Mathematics' if mode == 'math' else 'Text'}**.")
 
 
 
 
 
 
 
 
 
 
205
  await cb.answer("The mode has been changed.", show_alert=False)
206
  logger.info(f"User {user_id} set CAPTCHA mode to {mode}.")
207
 
@@ -223,7 +233,7 @@ async def join_request(client: Client, event: ChatJoinRequest):
223
  await client.send_message(event.chat.id, text="I need to be an administrator to perform this action.")
224
  return
225
 
226
- mode = captcha_modes.get(event.from_user.id, "math")
227
  captcha_text, img_path, choices, correct_answer = generate_captcha(event.from_user.id, mode)
228
  captcha_texts[event.from_user.id] = {
229
  'captcha_text': captcha_text,
 
201
  await cb.answer("❌ Invalid mode.", show_alert=True)
202
  return
203
  captcha_modes[user_id] = mode
204
+ keyboard = InlineKeyboardMarkup(
205
+ [
206
+ [InlineKeyboardButton("🔢 Mathematics", callback_data="mode_math")],
207
+ [InlineKeyboardButton("🔤 Text", callback_data="mode_text")],
208
+ [InlineKeyboardButton("❌ Cancel", callback_data="cancel_mode")]
209
+ ]
210
+ )
211
+ await cb.edit_message_text(
212
+ f"✅ CAPTCHA mode has been set to **{'Mathematics' if mode == 'math' else 'Text'}**.",
213
+ reply_markup=keyboard
214
+ )
215
  await cb.answer("The mode has been changed.", show_alert=False)
216
  logger.info(f"User {user_id} set CAPTCHA mode to {mode}.")
217
 
 
233
  await client.send_message(event.chat.id, text="I need to be an administrator to perform this action.")
234
  return
235
 
236
+ mode = captcha_modes.get(event.from_user.id, "text")
237
  captcha_text, img_path, choices, correct_answer = generate_captcha(event.from_user.id, mode)
238
  captcha_texts[event.from_user.id] = {
239
  'captcha_text': captcha_text,