randydev commited on
Commit
57ddd3f
Β·
verified Β·
1 Parent(s): 2b4f991
Files changed (1) hide show
  1. akn/manage/approve_params.py +75 -27
akn/manage/approve_params.py CHANGED
@@ -44,7 +44,8 @@ async def ubadmin_action(client: Client, callback: CallbackQuery):
44
  action_type = action.split('_')[0]
45
  admin_id = callback.from_user.id
46
  admin_mention = callback.from_user.mention
47
-
 
48
  request = await db_client.session.find_one({"user_id": int(user_id)})
49
  if not request:
50
  await callback.answer("❌ User request not found!", show_alert=True)
@@ -131,12 +132,13 @@ async def handle_approvalub(client, callback, request, user_id, admin_id, admin_
131
  )
132
  await notify_userub(client, user_id, bot_user)
133
  await client.send_message(
134
- PRIVATE_LOGS,
135
  f"βœ… Userbot Approved Successfully\n\n"
136
  f"πŸ‘€ User: {request.get('username', 'N/A')} ({user_id})\n"
137
  f"⭐ Username: {bot_user.username}\n"
138
  f"πŸ›  Approved by: {admin_mention}\n"
139
- f"⏰ Time: {dt.now().strftime('%Y-%m-%d %H:%M:%S')}"
 
140
  )
141
  except Exception as e:
142
  LOGS.error(f"Approval error: {str(e)}")
@@ -165,11 +167,12 @@ async def handle_errorub(client, callback, error, action, admin_mention):
165
  f"{callback.message.text}\n\n❌ Error: {str(error)}"
166
  )
167
  await client.send_message(
168
- PRIVATE_LOGS,
169
  f"🚨 Admin Action Error\n\n"
170
  f"Action: {action}\n"
171
  f"Admin: {admin_mention}\n"
172
- f"Error: {str(error)}"
 
173
  )
174
 
175
  @ren.on_callback_query(filters.regex(r"^(rejected_alldl|pending_alldl|approved_alldl)_(\d+)_(\w+)$"))
@@ -180,7 +183,8 @@ async def handle_admin_action(client: Client, callback: CallbackQuery):
180
  action_type = action.split('_')[0]
181
  admin_id = callback.from_user.id
182
  admin_mention = callback.from_user.mention
183
-
 
184
  try:
185
  request = await db_client.alldl_bot.find_one({"user_id": int(user_id)})
186
  if not request:
@@ -287,12 +291,13 @@ async def handle_admin_action(client: Client, callback: CallbackQuery):
287
  )
288
 
289
  await client.send_message(
290
- PRIVATE_LOGS,
291
  f"βœ… Bot Approved Successfully\n\n"
292
  f"πŸ‘€ User: {request.get('username', 'N/A')} ({user_id})\n"
293
  f"πŸ€– Bot: {bot_username}\n"
294
  f"πŸ›  Approved by: {admin_mention}\n"
295
- f"⏰ Time: {dt.now().strftime('%Y-%m-%d %H:%M:%S')}"
 
296
  )
297
 
298
  except Exception as e:
@@ -311,11 +316,12 @@ async def handle_admin_action(client: Client, callback: CallbackQuery):
311
  }
312
  )
313
  await client.send_message(
314
- PRIVATE_LOGS,
315
  f"❌ Bot Approval Failed\n\n"
316
  f"User ID: {user_id}\n"
317
  f"Error: {str(e)}\n"
318
- f"UUID: `{uuid}`"
 
319
  )
320
  await client.send_message(
321
  user_id,
@@ -340,17 +346,18 @@ async def handle_admin_action(client: Client, callback: CallbackQuery):
340
 
341
  except Exception as e:
342
  LOGS.error(f"Admin action error: {str(e)}")
343
- await callback.answer("⚠️ An error occurred!", show_alert=True)
344
  await callback.message.edit_text(
345
  f"{callback.message.text}\n\n"
346
  f"❌ Error: {str(e)}"
347
  )
348
  await client.send_message(
349
- PRIVATE_LOGS,
350
  f"🚨 Admin Action Error\n\n"
351
  f"Action: {action}\n"
352
  f"Admin: {admin_mention}\n"
353
- f"Error: {str(e)}"
 
354
  )
355
 
356
  @ren.on_callback_query(filters.regex(r"^(approve_capt|reject_capt)_(\d+)$"))
@@ -358,7 +365,8 @@ async def handle_captbot_action(client, callback: CallbackQuery):
358
  global storage_running
359
  action, user_id = callback.matches[0].groups()
360
  action_type = action.replace("_capt", "")
361
-
 
362
  update_data = {
363
  "status": "approved" if action_type == "approve" else "rejected",
364
  "admin_action": {
@@ -385,7 +393,11 @@ async def handle_captbot_action(client, callback: CallbackQuery):
385
  storage_running[user_id] = user_bots
386
  except Exception as e:
387
  await client.send_message(user_id, "Sorry Try Again")
388
- await client.send_message(PRIVATE_LOGS, f"Error {e}")
 
 
 
 
389
  return
390
 
391
  try:
@@ -426,7 +438,11 @@ async def handle_captbot_action(client, callback: CallbackQuery):
426
  upsert=True
427
  )
428
  except Exception as e:
429
- await client.send_message(PRIVATE_LOGS, f"Error {e}")
 
 
 
 
430
  await client.send_message(user_id, "Sorry Try Again")
431
  return
432
 
@@ -443,7 +459,8 @@ async def handle_sesibot_action(client, callback: CallbackQuery):
443
  global storage_running
444
  action, user_id = callback.matches[0].groups()
445
  action_type = action.replace("_sesibot", "")
446
-
 
447
  update_data = {
448
  "status": "approved" if action_type == "approve" else "rejected",
449
  "admin_action": {
@@ -470,7 +487,11 @@ async def handle_sesibot_action(client, callback: CallbackQuery):
470
  storage_running[user_id] = user_bots
471
  except Exception as e:
472
  await client.send_message(user_id, "Sorry Try Again")
473
- await client.send_message(PRIVATE_LOGS, f"Error {e}")
 
 
 
 
474
  return
475
 
476
  try:
@@ -507,7 +528,11 @@ async def handle_sesibot_action(client, callback: CallbackQuery):
507
  upsert=True
508
  )
509
  except Exception as e:
510
- await client.send_message(PRIVATE_LOGS, f"Error {e}")
 
 
 
 
511
  await client.send_message(user_id, "Sorry Try Again")
512
  return
513
 
@@ -524,7 +549,8 @@ async def handle_magicbot_action(client, callback: CallbackQuery):
524
  global storage_running
525
  action, user_id = callback.matches[0].groups()
526
  action_type = action.replace("_magicbot", "")
527
-
 
528
  update_data = {
529
  "status": "approved" if action_type == "approve" else "rejected",
530
  "admin_action": {
@@ -551,7 +577,11 @@ async def handle_magicbot_action(client, callback: CallbackQuery):
551
  storage_running[user_id] = user_bots
552
  except Exception as e:
553
  await client.send_message(user_id, "Sorry Try Again")
554
- await client.send_message(PRIVATE_LOGS, f"Error {e}")
 
 
 
 
555
  return
556
 
557
  try:
@@ -592,7 +622,11 @@ async def handle_magicbot_action(client, callback: CallbackQuery):
592
  upsert=True
593
  )
594
  except Exception as e:
595
- await client.send_message(PRIVATE_LOGS, f"Error {e}")
 
 
 
 
596
  await client.send_message(user_id, "Sorry Try Again")
597
  return
598
 
@@ -609,7 +643,8 @@ async def handle_ytbot_action(client, callback: CallbackQuery):
609
  global storage_running
610
  action, user_id = callback.matches[0].groups()
611
  action_type = action.replace("_magicbot", "")
612
-
 
613
  update_data = {
614
  "status": "approved" if action_type == "approve" else "rejected",
615
  "admin_action": {
@@ -635,7 +670,11 @@ async def handle_ytbot_action(client, callback: CallbackQuery):
635
  await user_bots.start()
636
  except Exception as e:
637
  await client.send_message(user_id, "Sorry Try Again")
638
- await client.send_message(PRIVATE_LOGS, f"Error {e}")
 
 
 
 
639
  return
640
 
641
  try:
@@ -676,7 +715,11 @@ async def handle_ytbot_action(client, callback: CallbackQuery):
676
  upsert=True
677
  )
678
  except Exception as e:
679
- await client.send_message(PRIVATE_LOGS, f"Error {e}")
 
 
 
 
680
  await client.send_message(user_id, "Sorry Try Again")
681
  return
682
 
@@ -693,7 +736,8 @@ async def handle_geminibot_action(client, callback: CallbackQuery):
693
  global storage_running
694
  action, user_id = callback.matches[0].groups()
695
  action_type = action.replace("_geminibot", "")
696
-
 
697
  update_data = {
698
  "status": "approved" if action_type == "approve" else "rejected",
699
  "admin_action": {
@@ -761,7 +805,11 @@ async def handle_geminibot_action(client, callback: CallbackQuery):
761
  upsert=True
762
  )
763
  except Exception as e:
764
- await client.send_message(PRIVATE_LOGS, f"Error {e}")
 
 
 
 
765
  await client.send_message(user_id, "Sorry Try Again")
766
  return
767
 
 
44
  action_type = action.split('_')[0]
45
  admin_id = callback.from_user.id
46
  admin_mention = callback.from_user.mention
47
+ if admin_id != 6477856957:
48
+ return await callback.answer("❌ Only Developer", show_alert=True)
49
  request = await db_client.session.find_one({"user_id": int(user_id)})
50
  if not request:
51
  await callback.answer("❌ User request not found!", show_alert=True)
 
132
  )
133
  await notify_userub(client, user_id, bot_user)
134
  await client.send_message(
135
+ "AkenoXDevSupport",
136
  f"βœ… Userbot Approved Successfully\n\n"
137
  f"πŸ‘€ User: {request.get('username', 'N/A')} ({user_id})\n"
138
  f"⭐ Username: {bot_user.username}\n"
139
  f"πŸ›  Approved by: {admin_mention}\n"
140
+ f"⏰ Time: {dt.now().strftime('%Y-%m-%d %H:%M:%S')}",
141
+ message_thread_id=23159
142
  )
143
  except Exception as e:
144
  LOGS.error(f"Approval error: {str(e)}")
 
167
  f"{callback.message.text}\n\n❌ Error: {str(error)}"
168
  )
169
  await client.send_message(
170
+ "AkenoXDevSupport",
171
  f"🚨 Admin Action Error\n\n"
172
  f"Action: {action}\n"
173
  f"Admin: {admin_mention}\n"
174
+ f"Error: {str(error)}",
175
+ message_thread_id=23245
176
  )
177
 
178
  @ren.on_callback_query(filters.regex(r"^(rejected_alldl|pending_alldl|approved_alldl)_(\d+)_(\w+)$"))
 
183
  action_type = action.split('_')[0]
184
  admin_id = callback.from_user.id
185
  admin_mention = callback.from_user.mention
186
+ if admin_id != 6477856957:
187
+ return await callback.answer("❌ Only Developer", show_alert=True)
188
  try:
189
  request = await db_client.alldl_bot.find_one({"user_id": int(user_id)})
190
  if not request:
 
291
  )
292
 
293
  await client.send_message(
294
+ "AkenoXDevSupport",
295
  f"βœ… Bot Approved Successfully\n\n"
296
  f"πŸ‘€ User: {request.get('username', 'N/A')} ({user_id})\n"
297
  f"πŸ€– Bot: {bot_username}\n"
298
  f"πŸ›  Approved by: {admin_mention}\n"
299
+ f"⏰ Time: {dt.now().strftime('%Y-%m-%d %H:%M:%S')}",
300
+ message_thread_id=23159
301
  )
302
 
303
  except Exception as e:
 
316
  }
317
  )
318
  await client.send_message(
319
+ "AkenoXDevSupport",
320
  f"❌ Bot Approval Failed\n\n"
321
  f"User ID: {user_id}\n"
322
  f"Error: {str(e)}\n"
323
+ f"UUID: `{uuid}`",
324
+ message_thread_id=23245
325
  )
326
  await client.send_message(
327
  user_id,
 
346
 
347
  except Exception as e:
348
  LOGS.error(f"Admin action error: {str(e)}")
349
+ await callback.answer("⚠️ error!", show_alert=True)
350
  await callback.message.edit_text(
351
  f"{callback.message.text}\n\n"
352
  f"❌ Error: {str(e)}"
353
  )
354
  await client.send_message(
355
+ "AkenoXDevSupport",
356
  f"🚨 Admin Action Error\n\n"
357
  f"Action: {action}\n"
358
  f"Admin: {admin_mention}\n"
359
+ f"Error: {str(e)}",
360
+ message_thread_id=23245
361
  )
362
 
363
  @ren.on_callback_query(filters.regex(r"^(approve_capt|reject_capt)_(\d+)$"))
 
365
  global storage_running
366
  action, user_id = callback.matches[0].groups()
367
  action_type = action.replace("_capt", "")
368
+ if callback.from_user.id != 6477856957:
369
+ return await callback.answer("❌ Only Developer", show_alert=True)
370
  update_data = {
371
  "status": "approved" if action_type == "approve" else "rejected",
372
  "admin_action": {
 
393
  storage_running[user_id] = user_bots
394
  except Exception as e:
395
  await client.send_message(user_id, "Sorry Try Again")
396
+ await client.send_message(
397
+ "AkenoXDevSupport",
398
+ f"Error captcha {str(e)}",
399
+ message_thread_id=23245
400
+ )
401
  return
402
 
403
  try:
 
438
  upsert=True
439
  )
440
  except Exception as e:
441
+ await client.send_message(
442
+ "AkenoXDevSupport",
443
+ f"Error captcha {str(e)}",
444
+ message_thread_id=23245
445
+ )
446
  await client.send_message(user_id, "Sorry Try Again")
447
  return
448
 
 
459
  global storage_running
460
  action, user_id = callback.matches[0].groups()
461
  action_type = action.replace("_sesibot", "")
462
+ if callback.from_user.id != 6477856957:
463
+ return await callback.answer("❌ Only Developer", show_alert=True)
464
  update_data = {
465
  "status": "approved" if action_type == "approve" else "rejected",
466
  "admin_action": {
 
487
  storage_running[user_id] = user_bots
488
  except Exception as e:
489
  await client.send_message(user_id, "Sorry Try Again")
490
+ await client.send_message(
491
+ "AkenoXDevSupport",
492
+ f"Error sesibot {str(e)}",
493
+ message_thread_id=23245
494
+ )
495
  return
496
 
497
  try:
 
528
  upsert=True
529
  )
530
  except Exception as e:
531
+ await client.send_message(
532
+ "AkenoXDevSupport",
533
+ f"Error sesibot {str(e)}",
534
+ message_thread_id=23245
535
+ )
536
  await client.send_message(user_id, "Sorry Try Again")
537
  return
538
 
 
549
  global storage_running
550
  action, user_id = callback.matches[0].groups()
551
  action_type = action.replace("_magicbot", "")
552
+ if callback.from_user.id != 6477856957:
553
+ return await callback.answer("❌ Only Developer", show_alert=True)
554
  update_data = {
555
  "status": "approved" if action_type == "approve" else "rejected",
556
  "admin_action": {
 
577
  storage_running[user_id] = user_bots
578
  except Exception as e:
579
  await client.send_message(user_id, "Sorry Try Again")
580
+ await client.send_message(
581
+ "AkenoXDevSupport",
582
+ f"Error magic {str(e)}",
583
+ message_thread_id=23245
584
+ )
585
  return
586
 
587
  try:
 
622
  upsert=True
623
  )
624
  except Exception as e:
625
+ await client.send_message(
626
+ "AkenoXDevSupport",
627
+ f"Error Magic {str(e)}",
628
+ message_thread_id=23245
629
+ )
630
  await client.send_message(user_id, "Sorry Try Again")
631
  return
632
 
 
643
  global storage_running
644
  action, user_id = callback.matches[0].groups()
645
  action_type = action.replace("_magicbot", "")
646
+ if callback.from_user.id != 6477856957:
647
+ return await callback.answer("❌ Only Developer", show_alert=True)
648
  update_data = {
649
  "status": "approved" if action_type == "approve" else "rejected",
650
  "admin_action": {
 
670
  await user_bots.start()
671
  except Exception as e:
672
  await client.send_message(user_id, "Sorry Try Again")
673
+ await client.send_message(
674
+ "AkenoXDevSupport",
675
+ f"Error ytbot {str(e)}",
676
+ message_thread_id=23245
677
+ )
678
  return
679
 
680
  try:
 
715
  upsert=True
716
  )
717
  except Exception as e:
718
+ await client.send_message(
719
+ "AkenoXDevSupport",
720
+ f"Error Ytbot {str(e)}",
721
+ message_thread_id=23245
722
+ )
723
  await client.send_message(user_id, "Sorry Try Again")
724
  return
725
 
 
736
  global storage_running
737
  action, user_id = callback.matches[0].groups()
738
  action_type = action.replace("_geminibot", "")
739
+ if callback.from_user.id != 6477856957:
740
+ return await callback.answer("❌ Only Developer", show_alert=True)
741
  update_data = {
742
  "status": "approved" if action_type == "approve" else "rejected",
743
  "admin_action": {
 
805
  upsert=True
806
  )
807
  except Exception as e:
808
+ await client.send_message(
809
+ "AkenoXDevSupport",
810
+ f"Error Gemini {str(e)}",
811
+ message_thread_id=23245
812
+ )
813
  await client.send_message(user_id, "Sorry Try Again")
814
  return
815